https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86490

--- Comment #10 from zenith432 at users dot sourceforge.net ---
Followup on what gold does...

First, it reads the symbol table from the archive (w/o using the plugin) - and
if it doesn't need any of the symbols in an LTO member of the archive - it
doesn't call the plugin's claim_file_handler on the member.

Second, even if it needs an LTO member from an archive - it first adds all the
LTO object's symbols to its own symbol table during the add_symbols callback
from the plugin.  For each symbol, it remembers which object file it first was
seen in and whether that first object file is claimed by a plugin.
Later, when get_symbols callback is called from the plugin to get resolutions -
it sets LDPR_PREVAILING_DEF_IRONLY for symbols it doesn't need, but only if the
symbol was first seen in the same object file.  If it was first seen in another
object file, it sets the resolution to either LDPR_PREEMPTED_IR or
LDPR_PREEMPTED_REG, depending on whether the symbol's first source is claimed
by a plugin or not.
This algorithm makes sure each IRONLY symbol only gets a single PREVAILING_DEF.

Reply via email to