[gold patch] do not allocate common symbols within the discarded output sections

Viktor Kutuzov vkutuzov@accesssoftek.com
Tue Sep 27 22:29:00 GMT 2011


Gold gets an internal error on computing of the final values for the
common symbols which were allocated within the discarded output
sections. An appropriate output section could be discarded by the linker
script.

Please find attached patch which prevents allocating of the common
symbols if its target output section has been discarded by any reason.

The command line below reproduces the problem. I tested it on CentOS
5.x/i386, but it should be reproducible on the different systems also.

vkutuzov@:/opt/build/binutils/src/gold/testsuite$ ../ld-new \
 -m elf_i386 --eh-frame-hdr --hash-style=gnu \
 -L/usr/lib -L/usr/lib/gcc/i386-redhat-linux/4.1.1 \
 -l:crt1.o -l:crti.o -l:crtbegin.o \
 -nostartfiles -nostdlib -T memory_test.t memory_test.o \
 -o memory_test -lc -l:crtend.o -l:crtn.o

../ld-new: internal error in address, at output.h:72


The memory_test.t script is a linker script from the current gold
testsuite set.

Would you review this patch?

Thanks.
Viktor


	* common.cc (Symbol_table::do_allocate_commons_list): prevent
 	allocation of the common symbols within the discarded output
	sections.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-gold-fix-allocate_commons_discarded_section.patch
Type: text/x-patch
Size: 1337 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20110927/6daf83fe/attachment.bin>


More information about the Binutils mailing list