aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-09-04 13:54:21 +0930
committerAlan Modra <amodra@gmail.com>2020-09-04 14:06:44 +0930
commit1e3b96fd6cf0c7d018083994ad951ccf92aba582 (patch)
tree0e091c1d3f126e5dbed7661c30bb0d5dfe35bb6a /bfd
parente062fcc8c2bf4c36386dce68ba7f1d408f22dedc (diff)
downloadbinutils-1e3b96fd6cf0c7d018083994ad951ccf92aba582.zip
binutils-1e3b96fd6cf0c7d018083994ad951ccf92aba582.tar.gz
binutils-1e3b96fd6cf0c7d018083994ad951ccf92aba582.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/elflink.c12
2 files changed, 12 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 1b58f95..a431f8f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,13 @@
+2020-09-04 Alan Modra <amodra@gmail.com>
+
+ 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.
+
2020-09-03 Nick Clifton <nickc@redhat.com>
PR 26521
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 5c085b1..1384c1a 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -4977,11 +4977,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
object and a shared object. */
bfd_boolean dynsym = FALSE;
- /* Plugin symbols aren't normal. Don't set def_regular or
- ref_regular for them, or make them dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- ;
- else if (! dynamic)
+ if (! dynamic)
{
if (! definition)
{
@@ -5162,10 +5158,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
&& !bfd_link_relocatable (info))
dynsym = FALSE;
- /* Nor should we make plugin symbols dynamic. */
- if ((abfd->flags & BFD_PLUGIN) != 0)
- dynsym = FALSE;
-
if (definition)
{
h->target_internal = isym->st_target_internal;
@@ -5192,7 +5184,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
}
}
- if (dynsym && h->dynindx == -1)
+ if (dynsym && (abfd->flags & BFD_PLUGIN) == 0 && h->dynindx == -1)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
goto error_free_vers;