aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-plugin
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-06-20 09:53:50 +0930
committerAlan Modra <amodra@gmail.com>2016-06-20 11:26:13 +0930
commit0616a2803812f5c13f8936d281bd71c3d9c09655 (patch)
tree9e08397ff38e47df39dccd4dbc7ac0d418d02bbd /ld/testsuite/ld-plugin
parent6336b4b7370b8034091364f500184c0a8674a340 (diff)
PR ld/20276: Set non_ir_ref on common symbol
Also, don't check alignment on symbol from plugin dummy input. bfd/ PR ld/20276 * elflink.c (elf_link_add_object_symbols): Don't check alignment on symbol from plugin dummy input. ld/ PR ld/20276 * plugin.c (plugin_notice): Set non_ir_ref on common symbols. * testsuite/ld-plugin/lto.exp (lto_link_tests): Add test for PR ld/20276. (lto_run_tests): Likewise. * testsuite/ld-plugin/pass.out: New file. * testsuite/ld-plugin/pr20276a.c: Likewise. * testsuite/ld-plugin/pr20276b.c: Likewise.
Diffstat (limited to 'ld/testsuite/ld-plugin')
-rw-r--r--ld/testsuite/ld-plugin/lto.exp9
-rw-r--r--ld/testsuite/ld-plugin/pass.out1
-rw-r--r--ld/testsuite/ld-plugin/pr20276a.c12
-rw-r--r--ld/testsuite/ld-plugin/pr20276b.c1
4 files changed, 23 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 7a13abbfdb..7743719e3f 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -183,6 +183,12 @@ set lto_link_tests [list \
[list "PR ld/19317 (1)" \
"$plug_opt" "-flto $lto_no_fat" \
{pr19317.c} {} "libpr19317.a"] \
+ [list "Build pr20276a.o" \
+ "" "-fno-lto" \
+ {pr20276a.c}] \
+ [list "Build pr20276b.o" \
+ "$plug_opt" "-flto $lto_no_fat" \
+ {pr20276b.c}] \
]
if { [at_least_gcc_version 4 7] } {
@@ -332,6 +338,9 @@ set lto_run_tests [list \
[list "PR ld/19317 (3)" \
"-O2 -flto tmpdir/pr19317-r.o" "" \
{dummy.c} "pr19317.exe" "pr19317.out" "-flto -O2" "c"] \
+ [list "Run pr20276" \
+ "-O2 -flto tmpdir/pr20276a.o tmpdir/pr20276b.o" "" \
+ {dummy.c} "pr20276" "pass.out" "-flto -O2" "c"] \
]
if { [at_least_gcc_version 4 7] } {
diff --git a/ld/testsuite/ld-plugin/pass.out b/ld/testsuite/ld-plugin/pass.out
new file mode 100644
index 0000000000..7ef22e9a43
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pass.out
@@ -0,0 +1 @@
+PASS
diff --git a/ld/testsuite/ld-plugin/pr20276a.c b/ld/testsuite/ld-plugin/pr20276a.c
new file mode 100644
index 0000000000..0b37bc7d30
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr20276a.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int global_var;
+extern void abort ();
+
+int main(void)
+{
+ if (global_var != 20)
+ abort ();
+ printf ("PASS\n");
+ return 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr20276b.c b/ld/testsuite/ld-plugin/pr20276b.c
new file mode 100644
index 0000000000..2ecbc2ca90
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr20276b.c
@@ -0,0 +1 @@
+int global_var = 20;