This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
.symtab behaviour query
- From: bd1976 gnu <bd1976gnu at gmail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 7 Mar 2018 16:38:10 +0000
- Subject: .symtab behaviour query
- Authentication-results: sourceware.org; auth=none
Hi All,
I have a question about binutils behaviour w.r.t the binding of symbols in
the .symtab section in a linked elf.
I was trying to understand the rationale behind the properties of the
symbols in the .symtab in a linked elf. Gold and GNU-ld change the binding
of symbols to STB_LOCAL when symbols have been resolved as having hidden
visibility. The Gold behaviour was added in:
https://sourceware.org/bugzilla/show_bug.cgi?id=9836, based off the
original GNU ld behaviour added in:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17089. I found a reference to
this in the sun linker guide which states " A hidden symbol contained in a
relocatable object is either removed or converted to STB_LOCAL binding when
the object is included in an executable file or shared object. " see:
https://docs.oracle.com/cd/E19120-01/open.solaris/819-0690/chapter6-79797/index.html
As far as I know the symbols in the .symtab section for a linked elf are
really only there to convey debugging information to binary tools and
debuggers. My question is: what is the rationale for the linkers behaviour
here?
If anyone can help with this it would be much appreciated!