summaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-03-30 00:38:39 +0000
committerH.J. Lu <hjl.tools@gmail.com>2013-03-30 00:38:39 +0000
commit329d37ede3b22d4577bb30a71a9d8e536a63248a (patch)
treef4ecbe2730ea3db74a4d20a38948f986e3c6ca0d /ld/testsuite
parentc3bd63d61f36bc0a40b8507d7f97707336c99a4f (diff)
downloadbinutils-redhat-329d37ede3b22d4577bb30a71a9d8e536a63248a.tar.gz
Set non_ir_ref if a symbol is referenced by a non-shared object
bfd/ PR ld/15323 * elf32-i386.c (elf_i386_check_relocs): Set non_ir_ref if a symbol is referenced by a non-shared object. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. ld/testsuite/ PR ld/15323 * ld-plugin/lto.exp (lto_link_tests): Add pr15323a-r.o. (lto_run_tests): Add a test for PR ld/15323. * ld-plugin/pr15323.out: New file. * ld-plugin/pr15323a.c: Likewise. * ld-plugin/pr15323b.c: Likewise.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog10
-rw-r--r--ld/testsuite/ld-plugin/lto.exp8
-rw-r--r--ld/testsuite/ld-plugin/pr15323.out1
-rw-r--r--ld/testsuite/ld-plugin/pr15323a.c14
-rw-r--r--ld/testsuite/ld-plugin/pr15323b.c3
5 files changed, 35 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 918f6643a2..a4b272f330 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2013-03-29 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/15323
+ * ld-plugin/lto.exp (lto_link_tests): Add pr15323a-r.o.
+ (lto_run_tests): Add a test for PR ld/15323.
+
+ * ld-plugin/pr15323.out: New file.
+ * ld-plugin/pr15323a.c: Likewise.
+ * ld-plugin/pr15323b.c: Likewise.
+
2013-03-22 Nick Clifton <nickc@redhat.com>
* ld-elf/init0.s: Add alloc attribute to .section directive.
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index cd4b25e2e3..cf1ddf3c3a 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -1,5 +1,5 @@
# Expect script for ld-plugin LTO tests
-# Copyright 2011
+# Copyright 2011, 2012, 2013
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -143,6 +143,9 @@ set lto_link_tests {
{"PR ld/13287"
"-flto -fuse-linker-plugin -Wl,--as-needed" "-flto"
{pr13287.cc} {} "pr13287.exe" "c++"}
+ {"PR ld/15323"
+ "-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto"
+ {pr15323a.c} {} "pr15323a-r.o" "c"}
}
# Generate input files for complex LTO tests for ELF.
@@ -266,6 +269,9 @@ set lto_run_tests {
{"PR ld/13201"
"-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" ""
{dummy.c} "pr13201.exe" "pr13201.out" "" "c"}
+ {"PR ld/15323"
+ "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr15323a-r.o" ""
+ {pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"}
}
# LTO run-time tests for ELF
diff --git a/ld/testsuite/ld-plugin/pr15323.out b/ld/testsuite/ld-plugin/pr15323.out
new file mode 100644
index 0000000000..d86bac9de5
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr15323.out
@@ -0,0 +1 @@
+OK
diff --git a/ld/testsuite/ld-plugin/pr15323a.c b/ld/testsuite/ld-plugin/pr15323a.c
new file mode 100644
index 0000000000..02a365b564
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr15323a.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int x;
+
+__attribute__((weak))
+void foobar (void) { x++; }
+
+int main (void)
+{
+ foobar ();
+ if (x == -1)
+ printf ("OK\n");
+ return 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr15323b.c b/ld/testsuite/ld-plugin/pr15323b.c
new file mode 100644
index 0000000000..3ce506330f
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr15323b.c
@@ -0,0 +1,3 @@
+extern int x;
+
+void foobar (void) { x--; }