{GOLD][PATCH PROPOSAL] prevent discarding of needed local symbols for the relocatable objects

Viktor Kutuzov vkutuzov@accesssoftek.com
Wed Feb 10 23:03:00 GMT 2010


Hi Ian,

I'm trying to cross build llvm and llvm-gcc on Linux for ARM by using
GOLD as the linker. This has exposed some problems we have in GOLD. 

One of them related to the assert in the relocate_for_relocatable()
method (target-reloc.h, line 557):

  new_symndx = object->symtab_index(r_sym);
  gold_assert(new_symndx != -1U);

This assert gets triggered when the build links glibc with the -r -X
flags (remove local symbols).

This happens because with the given -X option GOLD removes all local
symbols, including those which still needed to resolve static relocs
later.

LD keeps that kind of local symbols in the symbol table even if -X
requested. I guess GOLD should do the same.

Please find attached the patch that fixes this issue.

Thank you,
Viktor.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-gold-prevent_discard_needed_local_symbols.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100210/f477ac83/attachment.bin>


More information about the Binutils mailing list