Allow plugin syms to mark as-needed shared libs needed
We must tell LTO about symbols in all shared libraries loaded. That
means we can't load extra shared libraries after LTO recompilation, at
least, not those that affect the set of symbols that LTO cares about,
the IR symbols.
This change will likely result in complaints about --as-needed
libraries being loaded unnecessarily, but being correct is more
important than being optimal. One of the PR15146 tests regresses, and
while that could be hidden by disabling the missing dso message by
making it conditional on h->root.non_ir_ref_regular, that would just
be sweeping a problem under the rug.
bfd/
PR 15146
PR 26314
PR 26530
* elflink.c (elf_link_add_object_symbols): Do set def_regular
and ref_regular for IR symbols. Don't clear dynsym, allowing
IR symbols to load --as-needed shared libraries, but prevent
IR symbols from becoming dynamic.
ld/
* testsuite/ld-plugin/lto.exp: Don't run pr15146 tests.
* testsuite/ld-plugin/pr15146.d: Delete.
* testsuite/ld-plugin/pr15146a.c: Delete.
* testsuite/ld-plugin/pr15146b.c: Delete.
* testsuite/ld-plugin/pr15146c.c: Delete.
* testsuite/ld-plugin/pr15146d.c: Delete.