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]

Re: [PATCH v2] Treat STV_HIDDEN and STV_INTERNAL symbols as STB_LOCAL


On 07 May 2016 02:29, Maciej W. Rozycki wrote:
> In a reference to PR ld/19908 make ld.so respect symbol export classes 
> aka visibility and treat STV_HIDDEN and STV_INTERNAL symbols as local, 
> preventing such symbols from preempting exported symbols.
> 
> According to the ELF gABI[1] neither STV_HIDDEN nor STV_INTERNAL symbols 
> are supposed to be present in linked binaries:
> 
> "A hidden symbol contained in a relocatable object must be either
> removed or converted to STB_LOCAL binding by the link-editor when the
> relocatable object is included in an executable file or shared object."
> 
> "An internal symbol contained in a relocatable object must be either
> removed or converted to STB_LOCAL binding by the link-editor when the
> relocatable object is included in an executable file or shared object."
> 
> however some GNU binutils versions produce such symbols in some cases.  
> PR ld/19908 is one and we also have this note in scripts/abilist.awk:
> 
> # binutils versions up through at least 2.23 have some bugs that
> # caused STV_HIDDEN symbols to appear in .dynsym, though that is useless.
> 
> so clearly there is linked code out there which contains such symbols 
> which is prone to symbol table misinterpretation, and it'll be more 
> productive if we handle this gracefully, under the Robustness Principle: 
> "be liberal in what you accept, and conservative in what you produce", 
> especially as this is a simple (STV_HIDDEN|STV_INTERNAL) => STB_LOCAL 
> mapping.

your basic premise sounds fine as does your reading of the spec.
i glanced at the places you're adding checks and they look OK to
me, but i'm not super familiar with all the ldso/libdl paths.
-mike

Attachment: signature.asc
Description: Digital signature


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