aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-06-24 03:56:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-06-24 03:56:16 -0700
commit5376d47f66d0e4e07b3d42cb62ad07327cad4292 (patch)
treea2f4ab98b98a0cf98f62d014e7b6e7d6060fa4b6 /ld/testsuite
parenta5aae5087ca50f14e361cffe155ad3886afb56cb (diff)
downloadgdb-5376d47f66d0e4e07b3d42cb62ad07327cad4292.zip
gdb-5376d47f66d0e4e07b3d42cb62ad07327cad4292.tar.gz
gdb-5376d47f66d0e4e07b3d42cb62ad07327cad4292.tar.bz2
ld: Set non_ir_ref_regular on source for assignment
We need to set non_ir_ref_regular on the source for assignment to get the correct LTO resolution: 190 a27be7f4ad90c5ce PREVAILING_DEF real_g instead of 190 30c3b2d8f967f5ea PREVAILING_DEF_IRONLY real_g PR ld/26163 * ldexp.c (exp_fold_tree_1): Set non_ir_ref_regular on the source for assignment. * testsuite/ld-plugin/lto.exp: Run ld/26163 test. * testsuite/ld-plugin/pr26163a.c: New file. * testsuite/ld-plugin/pr26163b.c: Likewise.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-plugin/lto.exp8
-rw-r--r--ld/testsuite/ld-plugin/pr26163a.c9
-rw-r--r--ld/testsuite/ld-plugin/pr26163b.c19
3 files changed, 36 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index a7b9cac..5a6ba7a 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -207,6 +207,9 @@ set lto_link_tests [list \
[list "Build pr24406-2b.o" \
"" "-O2 -fno-lto" \
{pr24406-2b.c}] \
+ [list "Build pr26163a.o" \
+ "" "-O2 -fno-lto" \
+ {pr26163a.c}] \
]
if { [at_least_gcc_version 10 0] } {
@@ -502,6 +505,11 @@ set lto_run_tests [list \
{pr24406-2a.c} "pr24406-2" "pass.out" \
"-flto -O2" "c" "" \
"tmpdir/pr24406-2b.o -Wl,--wrap=cook"] \
+ [list "Run pr26163" \
+ "-O2 -flto" "" \
+ {pr26163b.c} "pr24406-2" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr26163a.o -Wl,--defsym,g=real_g"] \
]
if { [at_least_gcc_version 4 7] } {
diff --git a/ld/testsuite/ld-plugin/pr26163a.c b/ld/testsuite/ld-plugin/pr26163a.c
new file mode 100644
index 0000000..4c9979b
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr26163a.c
@@ -0,0 +1,9 @@
+extern int counter;
+
+extern void g(void);
+
+void f(void)
+{
+ g();
+ counter++;
+}
diff --git a/ld/testsuite/ld-plugin/pr26163b.c b/ld/testsuite/ld-plugin/pr26163b.c
new file mode 100644
index 0000000..5524b4e
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr26163b.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+int counter;
+extern void f(void);
+
+void
+real_g(void)
+{
+ counter++;
+}
+
+int main()
+{
+ real_g();
+ f();
+ if (counter == 3)
+ printf ("PASS\n");
+ return 0;
+}