aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-02-02 15:05:14 +1030
committerAlan Modra <amodra@gmail.com>2021-02-02 20:09:42 +1030
commit9918bff7cf2a566aaa2036d2242a61c140652dc7 (patch)
treeb2498f984c21d1aa2ef837e1dab0e281fd392a43 /ld
parent2bd3e4b8d2580839a457e221d4e1e09105248215 (diff)
downloadbinutils-9918bff7cf2a566aaa2036d2242a61c140652dc7.zip
binutils-9918bff7cf2a566aaa2036d2242a61c140652dc7.tar.gz
binutils-9918bff7cf2a566aaa2036d2242a61c140652dc7.tar.bz2
PR27311, ld.bfd (symbol from plugin): undefined reference
A default versioned symbol definition in a shared library is overridden by an unversioned definition in a regular object file, and thus should not be reason to make an as-needed library needed. bfd/ PR 27311 * elflink.c (_bfd_elf_add_default_symbol): Add override parameter. Use when handling default versioned symbol. Rename existing override variable to nondef_override and use for non-default versioned symbol. (elf_link_add_object_symbols): Adjust call to suit. Don't pull in as-needed libraries when override is set. ld/ * testsuite/ld-plugin/pr27311.d, * testsuite/ld-plugin/pr27311.ver, * testsuite/ld-plugin/pr27311a.c, * testsuite/ld-plugin/pr27311b.c, * testsuite/ld-plugin/pr27311c.c: New testcase. * testsuite/ld-plugin/lto.exp: Run it. Correct PR14918 and PR12982 entries.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog10
-rw-r--r--ld/testsuite/ld-plugin/lto.exp22
-rw-r--r--ld/testsuite/ld-plugin/pr27311.d4
-rw-r--r--ld/testsuite/ld-plugin/pr27311.ver3
-rw-r--r--ld/testsuite/ld-plugin/pr27311a.c1
-rw-r--r--ld/testsuite/ld-plugin/pr27311b.c1
-rw-r--r--ld/testsuite/ld-plugin/pr27311c.c5
7 files changed, 40 insertions, 6 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 6cf9d70..450137a 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,13 @@
+2021-02-02 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-plugin/pr27311.d,
+ * testsuite/ld-plugin/pr27311.ver,
+ * testsuite/ld-plugin/pr27311a.c,
+ * testsuite/ld-plugin/pr27311b.c,
+ * testsuite/ld-plugin/pr27311c.c: New testcase.
+ * testsuite/ld-plugin/lto.exp: Run it. Correct PR14918 and
+ PR12982 entries.
+
2021-02-01 Emery Hemingway <ehmry@posteo.net>
* configure.tgt: Add *-*-genode* as a target for AArch64 and x86.
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index dbda6c4..324adcd 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -415,6 +415,18 @@ set lto_link_elf_tests [list \
[list {pr26806.so} \
{-shared} {-fpic -O2 -flto} \
{pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
+ [list {pr27311a.so} \
+ {-shared -Wl,--version-script=pr27311.ver} {-fPIC} \
+ {pr27311a.c} {} {pr27311a.so}] \
+ [list {pr27311b.so} \
+ {-shared -Wl,--no-as-needed tmpdir/pr27311a.so} {-fPIC} \
+ {pr27311b.c} {} {pr27311b.so}] \
+ [list {pr27311c.o} \
+ {} {-flto} \
+ {pr27311c.c} {} {} {c}] \
+ [list {pr27311} \
+ {tmpdir/pr27311c.o -Wl,--no-as-needed,--rpath-link=. tmpdir/pr27311b.so} {} \
+ {dummy.c} {{readelf {--dyn-syms --wide} pr27311.d}} {pr27311}] \
]
# PR 14918 checks that libgcc is not spuriously included in a shared link of
@@ -423,11 +435,10 @@ set lto_link_elf_tests [list \
# __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1, so the
# test fails. Hence this code to skip the test.
if { ! [istarget "arm*-*-*"] } {
- lappend lto_link_elf_tests [list \
+ lappend lto_link_elf_tests \
[list "PR ld/14918" \
"-flto" "-flto" \
- {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"] \
- ]
+ {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"]
}
# PR 12982 checks that an executable stack is not created by default
@@ -435,11 +446,10 @@ if { ! [istarget "arm*-*-*"] } {
# executable stack for syscall restarts and signal returns, so we
# skip this test for that target.
if { ! [istarget "hppa*-*-*"] } {
- lappend lto_link_elf_tests [list \
+ lappend lto_link_elf_tests \
[list "PR ld/12982" \
"-O2 -flto -fuse-linker-plugin" "-O2 -flto" \
- {pr12982.c} {{"readelf" {-l --wide} "pr12982.d"}} "pr12982.exe"] \
- ]
+ {pr12982.c} {{"readelf" {-l --wide} "pr12982.d"}} "pr12982.exe"]
}
# Check final symbols in executables.
diff --git a/ld/testsuite/ld-plugin/pr27311.d b/ld/testsuite/ld-plugin/pr27311.d
new file mode 100644
index 0000000..debf41c
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr27311.d
@@ -0,0 +1,4 @@
+#failif
+#...
+.* _*inlib1.*
+#...
diff --git a/ld/testsuite/ld-plugin/pr27311.ver b/ld/testsuite/ld-plugin/pr27311.ver
new file mode 100644
index 0000000..324daf0
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr27311.ver
@@ -0,0 +1,3 @@
+LIBFOO {
+ *;
+};
diff --git a/ld/testsuite/ld-plugin/pr27311a.c b/ld/testsuite/ld-plugin/pr27311a.c
new file mode 100644
index 0000000..3149847
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr27311a.c
@@ -0,0 +1 @@
+void inlib1(void) {}
diff --git a/ld/testsuite/ld-plugin/pr27311b.c b/ld/testsuite/ld-plugin/pr27311b.c
new file mode 100644
index 0000000..ed9c8a7
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr27311b.c
@@ -0,0 +1 @@
+void inlib2(void) {}
diff --git a/ld/testsuite/ld-plugin/pr27311c.c b/ld/testsuite/ld-plugin/pr27311c.c
new file mode 100644
index 0000000..6712499
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr27311c.c
@@ -0,0 +1,5 @@
+void inlib1(void) {}
+int main()
+{
+ return 0;
+}