[PATCH] elf: Don't load archive element after dynamic definition

Alan Modra amodra@gmail.com
Wed Sep 2 14:29:30 GMT 2020


On Wed, Sep 02, 2020 at 06:22:08AM -0700, H.J. Lu wrote:
> > It's reasonably obvious that we need to load archive elements when
> > they define IR referenced symbols, because the archive element might
> > be an LTO object.  What's not so obvious is whether loading of shared
> > libraries should follow the same rule.  I think they should, in order
> > for LTO to get symbol resolution correct in corner cases.  Basically
> > LTO needs to know what shared libraries are loaded before
> > recompilation.  See commit a896df97b952 log comments.
> 
> There is dynamic_def for this purpose.

Your patch doesn't make changes to ld/plugin.c to inform LTO of the
availability of these symbols.  And if you did, then how does the
linker work out whether or not the LTO recompilation depended on those
symbols?  If it did change LTO recompilation then you had better
ensure the library really is loaded.  By the time you work all of that
out, if it is even possible, your patch will likely be very
complicated indeed.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list