This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH gold/6859] Symbols specified as -u <symbol> may erroneously get added to dynsym


Oracle has a full copyright assignment in place with the FSF.

This patch provides the fix for PR 6859 'Symbols specified as -u <symbol> may erroneously get added to the dynsym table'.  The problem turns out to be the
following:

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 (correctly) 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.

The patch below corrects this problem.  It was generated against cvs HEAD.

Testsuite execution has been verified to be identical between the unpatched and
the patched version.  No regressions were found.


	Cheers,
	Kris

ChangeLog entry:
================
2008-08-26  Kris Van Hees  <kris.van.hees@oracle.com>

	PR 6859
        * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
	symbols as not needing a dynsym entry.

Patch:
======
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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]