This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Add "ld -r" tests for PR ld/15323
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 11 Sep 2015 17:08:35 -0000
- Subject: [binutils-gdb] Add "ld -r" tests for PR ld/15323
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6d636d8c779d3be92dd5db021d12c2e3a2c5d419
commit 6d636d8c779d3be92dd5db021d12c2e3a2c5d419
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Sep 11 10:02:57 2015 -0700
Add "ld -r" tests for PR ld/15323
Weak defined function is turned into non-weak defined function by
"ld -r -flto" with GCC 5 due to a GCC 5 regression:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67548
Add "ld -r" tests for PR ld/15323 to make sure that any linker change
won't introduce linker regression for PR ld/15323.
* ld-plugin/lto.exp (lto_link_tests): Add a "ld -r" test for
PR ld/15323.
(lto_run_tests): Add a "ld -r" test for PR ld/15323.
Diff:
---
ld/testsuite/ChangeLog | 6 ++++++
ld/testsuite/ld-plugin/lto.exp | 10 ++++++++--
ld/testsuite/ld-plugin/pr15323a.c | 15 ++++++++++++---
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index ce7f8b7..9629dda 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-plugin/lto.exp (lto_link_tests): Add a "ld -r" test for
+ PR ld/15323.
+ (lto_run_tests): Add a "ld -r" test for PR ld/15323.
+
2015-09-09 Jiong Wang <jiong.wang@arm.com>
* ld-aarch64/tls-relax-ld-le-tiny.s: New testcase.
diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index 6d9500b..81e72b4 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -160,9 +160,12 @@ set lto_link_tests [list \
[list "PR ld/13287" \
"-flto -fuse-linker-plugin -Wl,--as-needed" "-flto" \
{pr13287.cc} {} "pr13287.exe" "c++"] \
- [list "PR ld/15323" \
+ [list "PR ld/15323 (1)" \
"" "-O2" \
{pr15323a.c} {} "" "c"] \
+ [list "PR ld/15323 (2)" \
+ "-O2 -flto -r -nostdlib" "-O2 -flto" \
+ {pr15323a.c} {} "pr15323a-r.o" "c"] \
[list "Compile(1) PR ld/pr16846" \
"" "-flto" \
{pr16846a.c pr16846b.c} {} ""] \
@@ -315,9 +318,12 @@ set lto_run_tests [list \
[list "PR ld/13201" \
"-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" "" \
{dummy.c} "pr13201.exe" "pr13201.out" "" "c"] \
- [list "PR ld/15323" \
+ [list "PR ld/15323 (3)" \
"-O2 -flto -fuse-linker-plugin tmpdir/pr15323a.o" "" \
{pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"] \
+ [list "PR ld/15323 (4)" \
+ "-O2 -flto tmpdir/pr15323a-r.o" "" \
+ {dummy.c} "pr15323a.exe" "pr15323.out" "-flto -O2" "c"] \
]
if { [at_least_gcc_version 4 7] } {
diff --git a/ld/testsuite/ld-plugin/pr15323a.c b/ld/testsuite/ld-plugin/pr15323a.c
index 02a365b..9c38948 100644
--- a/ld/testsuite/ld-plugin/pr15323a.c
+++ b/ld/testsuite/ld-plugin/pr15323a.c
@@ -1,14 +1,23 @@
#include <stdio.h>
int x;
+int y;
__attribute__((weak))
-void foobar (void) { x++; }
+void foobar (void) { y++; x++; }
int main (void)
{
foobar ();
- if (x == -1)
- printf ("OK\n");
+ if (y == 0)
+ {
+ if (x == -1)
+ printf ("OK\n");
+ }
+ else
+ {
+ if (x == 1)
+ printf ("OK\n");
+ }
return 0;
}