This is the mail archive of the binutils@sources.redhat.com 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: unreferenced local symbols generated in .dynsym


Roland McGrath <roland at redhat dot com> writes:

> There should never be local symbols in .dynsym unless they are referenced
> by dynamic relocs.  Other superfluous symbols like the FILE symbol got
> removed, but the section symbols remain no matter what I do.  This is buggy.

A bit of a pain to fix in the general case, unfortunately.  The
section symbols are added by _bfd_elf_link_renumber_dynsyms(), which
is called by size_dynamic_sections().  At that point we want to know
the final size of all the dynamic sections.  However, at that point we
don't currently know which output sections will need relocs.  So we
just create a dynamic symbol for all the output sections.  I think
this is what the Solaris linker does as well.

To fix this we need new data structures to record which output
sections will need dynamic relocs, so that the dynamic symbol is
available when we get around to doing reloc processing.  Of course, in
ordinary cases we don't need a reloc against a dynamic section.  They
tend to be needed in cases where non-PIC code is linked into a shared
library, so we need to copy over the relocs but we don't necessarily
have a global symbol to hang them on.

Ian


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