diff mbox

[libgo] Remove unused declarations in runtime.h

Message ID 2295664.zC7BSugLvC@polaris
State New
Headers show

Commit Message

Eric Botcazou Oct. 19, 2016, 10:38 p.m. UTC
Hi,

linking any Go program on SPARC/Solaris with the GNU assembler and the Sun 
linker yields a warning:

ld: warning: relocation error: R_SPARC_UA32: file 
/sydney.a/users/botcazou/gcc-head/sparc-sun-
solaris2.10/./libgo/libgobegin.a(libgobegin_a-go-main.o): symbol 
runtime_startup_random_data: external symbolic relocation against non-
allocatable section .debug_info; cannot be processed at runtime: relocation 
ignored

It's because (almost) every C file in runtime/ includes runtime.h, which has 
these lines:

byte*  runtime_startup_random_data;
uint32 runtime_startup_random_data_len;
void   runtime_get_random_data(byte**, int32*);

which cause (almost) every object file to have the first 2 as common symbols 
and this runs afoul of some limitation of the Sun linker.  Now there seem to 
be no other references to these 3 objects in the libgo directory and removing 
them doesn't seem to change the behavior of the Go compiler so the attached 
patch does just that.

Tested on x86_64-suse-linux and SPARC/Solaris, OK for mainline?


2016-10-19  Eric Botcazou  <ebotcazou@adacore.com>

	* runtime/runtime.h (runtime_startup_random_data): Delete.
	(runtime_startup_random_data_len): Likewise.
	(runtime_get_random_data): Likewise.

-- 
Eric Botcazou
diff mbox

Patch

Index: runtime/runtime.h
===================================================================
--- runtime/runtime.h	(revision 241326)
+++ runtime/runtime.h	(working copy)
@@ -220,10 +220,6 @@  extern bool runtime_copystack;
 #define USED(v)		((void) v)
 #define	ROUND(x, n)	(((x)+(n)-1)&~(uintptr)((n)-1)) /* all-caps to mark as macro: it evaluates n twice */
 
-byte*	runtime_startup_random_data;
-uint32	runtime_startup_random_data_len;
-void	runtime_get_random_data(byte**, int32*);
-
 enum {
 	// hashinit wants this many random bytes
 	HashRandomBytes = 32