[PATCH v2] Treat STV_HIDDEN and STV_INTERNAL symbols as STB_LOCAL

Mike Frysinger vapier@gentoo.org
Sun May 22 04:16:00 GMT 2016


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20160522/e249d8b6/attachment.sig>


More information about the Binutils mailing list