Add tests for PR ld/16846
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 22 Apr 2014 17:22:39 +0000 (10:22 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 22 Apr 2014 17:22:39 +0000 (10:22 -0700)
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
ld/testsuite/ld-plugin/lto.exp
ld/testsuite/ld-plugin/pr16846a.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr16846b.c [new file with mode: 0644]
ld/testsuite/ld-plugin/pr16846c.c [new file with mode: 0644]

index 5ac4d37a328a2cdba20196ceca609ef24204628a..6fb55b204af7b385cc86855cb80323d2e73fafed 100644 (file)
@@ -1,3 +1,11 @@
+2014-04-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+       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  <blue@cmd.nu>
 
        * ld-discard/extern.d: Remove openrisc and or32 support.  Add
index 1a525fce8e11b1dfc73ddd289c45069c56886e49..6ff474ebd1591effaecc7b5603286e7096c59be8 100644 (file)
@@ -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 (file)
index 0000000..2f119a4
--- /dev/null
@@ -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 (file)
index 0000000..bd8ddf3
--- /dev/null
@@ -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 (file)
index 0000000..3f39c5b
--- /dev/null
@@ -0,0 +1 @@
+__thread int foo;