[PATCH] elf: Add sym_cache to elf_link_hash_table

H.J. Lu hjl.tools@gmail.com
Thu Jul 30 10:39:43 GMT 2020


On Thu, Jul 30, 2020 at 2:32 AM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Jul 29, 2020 at 03:22:58PM -0700, H.J. Lu via Binutils wrote:
> > Normally an undefined symbol is treated as a reference.  Linker will
> > try to satisfy the reference.  This feature is used to bring a symbol
> > definition into output without explicit relocation.  If there is no
> > definition nor relocation, linker will remove undefined symbol from
> > symbol table in output (PR ld/4317).  But GCC 10 LTO may generate
> > separate debug info files which contain undefined symbols without
> > relocations:
>
> Surely this is just a gcc bug?  We search libraries again after
> loading the LTO output, so one would expect that undefined symbols
> satisfied by an archive (or as-needed shared library) would lead to
> extra files being linked.
>
> I'd like to better understand just how this problem occurs though.  As
> it is, I suspect there might be something else going on here, for
> example, ranlib being run without a plugin when building the archives.

I will double check.

> >       (sym_cache): Moved before elf_link_hash_table.
> >       (elf_link_hash_table): Add sym_cache.
>
> Please commit the above and related backend changes as a separate
> patch, preapproved.

I am checking in this patch.

> >       * elflink.c (_bfd_elf_merge_symbol): After all LTO IR symbols
> >       have been read, skip all undefined symbols without relocation.
> >       (elf_link_add_object_symbols): Set has_reloc_after_lto_all_symbols_read
> >       after all LTO IR symbols have been read.
>
> But not this bit just yet.
>
> --
> Alan Modra
> Australia Development Lab, IBM



-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-elf-Add-sym_cache-to-elf_link_hash_table.patch
Type: text/x-patch
Size: 72218 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20200730/9cd148db/attachment-0001.bin>


More information about the Binutils mailing list