Drop undefined local symbols from symtab?

Alan Modra amodra@gmail.com
Wed Feb 18 12:48:00 GMT 2015


On Wed, Feb 18, 2015 at 03:34:43AM -0800, H.J. Lu wrote:
> On Wed, Feb 18, 2015 at 3:27 AM, Alan Modra <amodra@gmail.com> wrote:
> > Does anyone see any harm in dropping undefined local symbols from
> > .symtab?  I've been meaning to do this for a while, mainly to get rid
> > of undefined ppc64 "dot-symbols".
> >
> > diff --git a/bfd/ChangeLog b/bfd/ChangeLog
> > index 44fc2bb..138c4ba 100644
> > --- a/bfd/ChangeLog
> > +++ b/bfd/ChangeLog
> > @@ -1,3 +1,8 @@
> > +2015-02-18  Alan Modra  <amodra@gmail.com>
> > +
> > +       * elflink.c (elf_link_input_bfd): Drop undefined local syms.
> > +       (elf_link_output_extsym): Likewise.  Tidy.  Expand comment.
> > +
> >  2015-02-17  Alan Modra  <amodra@gmail.com>
> 
> Can you also strip undefined global symbols:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=4317

Probably.  I'll take a look tomorrow.  Most likely just a matter of
replacing the ELF_ST_BIND test in my elf_link_output_extsym change
with a test of !flinfo->info->relocatable.  And perhaps arranging to
only strip from .symtab if the sym isn't emitted to .dynsym.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list