From 6955136728a68365bbb5e6e1327dff1654b2a0ca Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 3 Feb 2021 10:57:12 +1030 Subject: [PATCH] PR27311 again, ld.bfd (symbol from plugin): undefined reference bfd/ PR 27311 * elflink.c (_bfd_elf_add_default_symbol): Clear override when undecorated symbol will have a different version. ld/ * testsuite/ld-ifunc/ifunc.exp (libpr16467b.so, libpr16467bn.so): Link with --as-needed. --- bfd/ChangeLog | 6 ++++++ bfd/elflink.c | 6 +++++- ld/ChangeLog | 5 +++++ ld/testsuite/ld-ifunc/ifunc.exp | 4 ++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d65c56d009b..f76b7a1f264 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2021-02-03 Alan Modra + + PR 27311 + * elflink.c (_bfd_elf_add_default_symbol): Clear override when + undecorated symbol will have a different version. + 2021-02-02 Alan Modra PR 27311 diff --git a/bfd/elflink.c b/bfd/elflink.c index 7ac38cac691..5af32ef0a81 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1946,12 +1946,16 @@ _bfd_elf_add_default_symbol (bfd *abfd, if (hi->verinfo.vertree != NULL && hide) { (*bed->elf_backend_hide_symbol) (info, hi, TRUE); + *override = FALSE; goto nondefault; } } if (hi->verinfo.vertree != NULL && strcmp (p + 1 + (p[1] == '@'), hi->verinfo.vertree->name) != 0) - goto nondefault; + { + *override = FALSE; + goto nondefault; + } } if (!*override) diff --git a/ld/ChangeLog b/ld/ChangeLog index 450137a1bda..e5f9beaabf0 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2021-02-03 Alan Modra + + * testsuite/ld-ifunc/ifunc.exp (libpr16467b.so, libpr16467bn.so): + Link with --as-needed. + 2021-02-02 Alan Modra * testsuite/ld-plugin/pr27311.d, diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp index 9d3ace65216..45b47d7d6a8 100644 --- a/ld/testsuite/ld-ifunc/ifunc.exp +++ b/ld/testsuite/ld-ifunc/ifunc.exp @@ -397,7 +397,7 @@ run_cc_link_tests [list \ ] \ [list \ "Build libpr16467b.so" \ - "-shared tmpdir/pr16467b.o tmpdir/libpr16467a.so \ + "-shared -Wl,--as-needed tmpdir/pr16467b.o tmpdir/libpr16467a.so \ -Wl,--version-script=pr16467b.map" \ "-fPIC" \ { dummy.c } \ @@ -422,7 +422,7 @@ run_cc_link_tests [list \ ] \ [list \ "Build libpr16467bn.so" \ - "-shared tmpdir/pr16467b.o tmpdir/libpr16467an.so \ + "-shared -Wl,--as-needed tmpdir/pr16467b.o tmpdir/libpr16467an.so \ -Wl,--version-script=pr16467b.map" \ "-fPIC" \ { dummy.c } \ -- 2.30.2