[PATCH] LTO: Ignore undefined symbols without relocation

H.J. Lu hjl.tools@gmail.com
Thu Jul 30 11:51:35 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.

A testcase is on pr96385 branch at:

https://gitlab.com/x86-gcc/gcc-bugs

-- 
H.J.


More information about the Binutils mailing list