aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2023-03-29 13:06:26 -0700
committerH.J. Lu <hjl.tools@gmail.com>2023-03-31 08:34:48 -0700
commit79cfb928f552401e3cec7a208a87eb74aa0d2d8b (patch)
tree77b7db15ab24daeead73c0919928791c6b7f38c4 /ld/testsuite
parent5d49758d2c04dcf0d685f99e85a553e7c3891e34 (diff)
downloadbinutils-79cfb928f552401e3cec7a208a87eb74aa0d2d8b.zip
binutils-79cfb928f552401e3cec7a208a87eb74aa0d2d8b.tar.gz
binutils-79cfb928f552401e3cec7a208a87eb74aa0d2d8b.tar.bz2
lto: Don't add indirect symbols for versioned aliases in IR
Linker adds indirect symbols for versioned symbol aliases, which are created by ".symver foo, foo@FOO", by checking symbol type, value and section so that references to foo will be replaced by references to foo@FOO if foo and foo@FOO have the same symbol type, value and section. But in IR, since all symbols of the same type have the same value and section, we can't tell if a symbol is an alias of another symbol by their types, values and sections. We shouldn't add indirect symbols for versioned symbol aliases in IR. bfd/ PR ld/30281 * elflink.c (elf_link_add_object_symbols): Don't add indirect symbols for ".symver foo, foo@FOO" aliases in IR. ld/ PR ld/30281 * testsuite/ld-plugin/lto.exp: Add PR ld/30281 test. * testsuite/ld-plugin/pr30281.t: New file. * testsuite/ld-plugin/pr30281.c: Likewise.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-plugin/lto.exp9
-rw-r--r--ld/testsuite/ld-plugin/pr30281.c4
-rw-r--r--ld/testsuite/ld-plugin/pr30281.t4
3 files changed, 17 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 98e8111..e7e7952 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -530,6 +530,15 @@ set lto_link_elf_tests [list \
{} \
"pr29086" \
] \
+ [list \
+ "Build pr30281.so" \
+ "-shared -Wl,--version-script,pr30281.t \
+ -O2 -fPIC -flto-partition=max -flto=2" \
+ "-O2 -fPIC -flto-partition=max -flto=2" \
+ {pr30281.c} \
+ "" \
+ "pr30281.so" \
+ ] \
]
# PR 14918 checks that libgcc is not spuriously included in a shared link of
diff --git a/ld/testsuite/ld-plugin/pr30281.c b/ld/testsuite/ld-plugin/pr30281.c
new file mode 100644
index 0000000..ba9722a
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr30281.c
@@ -0,0 +1,4 @@
+extern __inline __attribute__((__gnu_inline__)) void foo(void) {}
+__attribute__((__symver__("foo@GLIBC_2.2.5")))
+int __collector_foo_2_2(void) {}
+void foo(void) {}
diff --git a/ld/testsuite/ld-plugin/pr30281.t b/ld/testsuite/ld-plugin/pr30281.t
new file mode 100644
index 0000000..3169ad3
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr30281.t
@@ -0,0 +1,4 @@
+GLIBC_2.2.5 {
+ global:
+ foo;
+};