Gold handles explicitly undefined symbols (-u <symbol>) differently from how the old GNU linker handles then. With gold, if the symbol does not appear defined in any input object, it is added to both the symtab (symbol table) and the dynsym (dynamic symbol table) as an undefined symbol. The old linker only adds the symbol to the symtab in that case. It works fine if the symbol gets defined in an input object. The reason for this problem turns out to be the fact that during input object processing, "-u" symbols are checked as symbol tables are processed. Then, all "-u" symbols are added as undefined symbols unless they were already seen (i.e. it adds all symbols that didn't appear in input object symbol tables). The fix for this problem turns out to be very easy: mark the "-u" symbols that are added after input object processing as not needing dynsym entries.
Index: gold/symtab.cc =================================================================== RCS file: /cvs/src/src/gold/symtab.cc,v retrieving revision 1.107 diff -r1.107 symtab.cc 176a177 > this->dynsym_index_ = -1; -- Summary: Symbols specified as -u <symbol> may erroneously get added to the dynsym table Product: binutils Version: 2.19 (HEAD) Status: NEW Severity: normal Priority: P2 Component: gold AssignedTo: ian at airs dot com ReportedBy: kris dot van dot hees at oracle dot com CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=6859 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils