[libgo] Remove unused declarations in runtime.h

Eric Botcazou ebotcazou@adacore.com
Wed Oct 19 22:38:00 GMT 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 560 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161019/cc7d48da/attachment.bin>


More information about the Gcc-patches mailing list