From 43c001c7d638bde9f310fdc3a199e02036f7b205 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 22 Apr 2014 10:22:39 -0700 Subject: [PATCH] Add tests for PR ld/16846 PR ld/16846 * ld-plugin/lto.exp (lto_link_tests): Add tests for PR ld/16846. * ld-plugin/pr16846a.c: New file. * ld-plugin/pr16846b.c: Likewise. * ld-plugin/pr16846c.c: Likewise. --- ld/testsuite/ChangeLog | 8 ++++++++ ld/testsuite/ld-plugin/lto.exp | 12 ++++++++++++ ld/testsuite/ld-plugin/pr16846a.c | 7 +++++++ ld/testsuite/ld-plugin/pr16846b.c | 7 +++++++ ld/testsuite/ld-plugin/pr16846c.c | 1 + 5 files changed, 35 insertions(+) create mode 100644 ld/testsuite/ld-plugin/pr16846a.c create mode 100644 ld/testsuite/ld-plugin/pr16846b.c create mode 100644 ld/testsuite/ld-plugin/pr16846c.c diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 5ac4d37a328..6fb55b204af 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2014-04-22 H.J. Lu + + PR ld/16846 + * ld-plugin/lto.exp (lto_link_tests): Add tests for PR ld/16846. + * ld-plugin/pr16846a.c: New file. + * ld-plugin/pr16846b.c: Likewise. + * ld-plugin/pr16846c.c: Likewise. + 2014-04-22 Christian Svensson * ld-discard/extern.d: Remove openrisc and or32 support. Add diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 1a525fce8e1..6ff474ebd15 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -139,6 +139,18 @@ set lto_link_tests { {"PR ld/15323" "" "-O2" {pr15323a.c} {} "libdummy.a" "c"} + {"Build libdummy.a(1) PR ld/pr16846" + "" "-flto" + {pr16846a.c pr16846b.c} {} "libdummy.a"} + {"Build libdummy.a(2) PR ld/pr16846" + "" "" + {pr16846c.c} {} "libdummy.a"} + {"PR ld/pr16846(1)" + "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846b.o tmpdir/pr16846c.o" "" + {dummy.c} {} "pr16846a.exe"} + {"PR ld/pr16846(2)" + "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846c.o tmpdir/pr16846b.o" "" + {dummy.c} {} "pr16846b.exe"} } if { [at_least_gcc_version 4 7] } { diff --git a/ld/testsuite/ld-plugin/pr16846a.c b/ld/testsuite/ld-plugin/pr16846a.c new file mode 100644 index 00000000000..2f119a4912a --- /dev/null +++ b/ld/testsuite/ld-plugin/pr16846a.c @@ -0,0 +1,7 @@ +extern int bar (void); + +int +main () +{ + return bar (); +} diff --git a/ld/testsuite/ld-plugin/pr16846b.c b/ld/testsuite/ld-plugin/pr16846b.c new file mode 100644 index 00000000000..bd8ddf3573f --- /dev/null +++ b/ld/testsuite/ld-plugin/pr16846b.c @@ -0,0 +1,7 @@ +extern __thread int foo; + +int +bar (void) +{ + return foo; +} diff --git a/ld/testsuite/ld-plugin/pr16846c.c b/ld/testsuite/ld-plugin/pr16846c.c new file mode 100644 index 00000000000..3f39c5bdb76 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr16846c.c @@ -0,0 +1 @@ +__thread int foo; -- 2.30.2