aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-plugin
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2014-08-07 09:53:46 +0930
committerAlan Modra <amodra@gmail.com>2014-08-07 10:28:48 +0930
commitdb7129469b10a701659f0e38e3edeb2191236831 (patch)
tree7434faef30933c44ba6d79bc9f9f4b136f07f928 /ld/testsuite/ld-plugin
parent59c2656733ccb54660f48c10608f4c1753dcaf01 (diff)
downloadgdb-db7129469b10a701659f0e38e3edeb2191236831.zip
gdb-db7129469b10a701659f0e38e3edeb2191236831.tar.gz
gdb-db7129469b10a701659f0e38e3edeb2191236831.tar.bz2
Don't issue a warning for references in LTO IR to warning symbols
bfd/ PR ld/16746 * linker.c (_bfd_generic_link_add_one_symbol): Don't issue a warning for references in LTO IR to warning symbols. ld/testsuite/ PR ld/16746 * ld-plugin/lto.exp: Add 4 tests for PR ld/16746. * ld-plugin/pr16746a.c: New file. * ld-plugin/pr16746b.c: Likewise. * ld-plugin/pr16746c.c: Likewise. * ld-plugin/pr16746d.c: Likewise.
Diffstat (limited to 'ld/testsuite/ld-plugin')
-rw-r--r--ld/testsuite/ld-plugin/lto.exp26
-rw-r--r--ld/testsuite/ld-plugin/pr16746a.c3
-rw-r--r--ld/testsuite/ld-plugin/pr16746b.c5
-rw-r--r--ld/testsuite/ld-plugin/pr16746c.c8
-rw-r--r--ld/testsuite/ld-plugin/pr16746d.c8
5 files changed, 50 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 432c753..7ff5bfb 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -232,6 +232,18 @@ set lto_link_elf_tests [list \
[list "Build libpr15146d.a" \
"$plug_opt" "-flto -O2" \
{pr15146d.c} {} "lib15146d.a"] \
+ [list "Build libpr16746a.a" \
+ "" "" \
+ {pr16746a.c pr16746b.c} {} "lib15146a.a"] \
+ [list "Build libpr16746b.a" \
+ "$plug_opt" "-O2 -flto" \
+ {pr16746c.c pr16746d.c} {} "lib15146b.a"] \
+ [list "PR ld/16746 (1)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
+ {dummy.c} {} "pr16746a.exe"] \
+ [list "PR ld/16746 (2)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
+ {dummy.c} {} "pr16746b.exe"] \
]
# Check final symbols in executables.
@@ -335,6 +347,20 @@ if { [is_elf_format] && [check_lto_shared_available] } {
} {
fail $testname
}
+ set testname "PR ld/16746 (3)"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
+ if { [ regexp "warning: foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+ set testname "PR ld/16746 (4)"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"]
+ if { [ regexp "warning: foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
}
set testname "Build liblto-11.a"
diff --git a/ld/testsuite/ld-plugin/pr16746a.c b/ld/testsuite/ld-plugin/pr16746a.c
new file mode 100644
index 0000000..1705ef1
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr16746a.c
@@ -0,0 +1,3 @@
+static const char __evoke_link_warning_foobar[]
+ __attribute__ ((used, section (".gnu.warning.foobar\n\t#")))
+ = "foobar";
diff --git a/ld/testsuite/ld-plugin/pr16746b.c b/ld/testsuite/ld-plugin/pr16746b.c
new file mode 100644
index 0000000..c3b7a78
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr16746b.c
@@ -0,0 +1,5 @@
+static const char __evoke_link_warning_foobar[]
+ __attribute__ ((used, section (".gnu.warning.foobar\n\t#")))
+ = "foobar";
+
+void foobar (void) {}
diff --git a/ld/testsuite/ld-plugin/pr16746c.c b/ld/testsuite/ld-plugin/pr16746c.c
new file mode 100644
index 0000000..fb68ab7
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr16746c.c
@@ -0,0 +1,8 @@
+extern void foobar (void);
+int
+main (int argc, char **argv)
+{
+ if (__builtin_constant_p (argc))
+ foobar ();
+ return 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr16746d.c b/ld/testsuite/ld-plugin/pr16746d.c
new file mode 100644
index 0000000..1fee4dd
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr16746d.c
@@ -0,0 +1,8 @@
+extern void foobar (void);
+int
+main (int argc, char **argv)
+{
+ if (!__builtin_constant_p (argc))
+ foobar ();
+ return 0;
+}