This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed, PATCH] Update PR ld/21964 tests


	* testsuite/ld-elf/pr21964-1a.c (foo): Renamed to ...
	(foo1): This.
	* testsuite/ld-elf/pr21964-1b.c: Rewrite.
	* testsuite/ld-elf/pr21964-1c.c: New file.
	* testsuite/ld-elf/pr21964-2c.c: Likewise.
	* testsuite/ld-elf/pr21964-2a.c (foo): Renamed to ...
	(foo1): This.
	* testsuite/ld-elf/pr21964-2b.c: Rewrite.
	* testsuite/ld-elf/shared.exp: Update PR ld/21964 tests.
---
 ld/ChangeLog                     | 13 +++++++++++++
 ld/testsuite/ld-elf/pr21964-1a.c |  3 ++-
 ld/testsuite/ld-elf/pr21964-1b.c | 22 +++++-----------------
 ld/testsuite/ld-elf/pr21964-1c.c | 29 +++++++++++++++++++++++++++++
 ld/testsuite/ld-elf/pr21964-2a.c |  3 ++-
 ld/testsuite/ld-elf/pr21964-2b.c | 35 ++++++++++-------------------------
 ld/testsuite/ld-elf/pr21964-2c.c | 32 ++++++++++++++++++++++++++++++++
 ld/testsuite/ld-elf/shared.exp   | 22 ++++++++++++++--------
 8 files changed, 107 insertions(+), 52 deletions(-)
 create mode 100644 ld/testsuite/ld-elf/pr21964-1c.c
 create mode 100644 ld/testsuite/ld-elf/pr21964-2c.c

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 5e2ddf478e..64e7c743ad 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
+2017-08-22  H.J. Lu  <hongjiu.lu@intel.com>
+	    Alan Modra  <amodra@gmail.com>
+
+	* testsuite/ld-elf/pr21964-1a.c (foo): Renamed to ...
+	(foo1): This.
+	* testsuite/ld-elf/pr21964-1b.c: Rewrite.
+	* testsuite/ld-elf/pr21964-1c.c: New file.
+	* testsuite/ld-elf/pr21964-2c.c: Likewise.
+	* testsuite/ld-elf/pr21964-2a.c (foo): Renamed to ...
+	(foo1): This.
+	* testsuite/ld-elf/pr21964-2b.c: Rewrite.
+	* testsuite/ld-elf/shared.exp: Update PR ld/21964 tests.
+
 2017-08-21  H.J. Lu  <hongjiu.lu@intel.com>
 	    Alan Modra  <amodra@gmail.com>
 
diff --git a/ld/testsuite/ld-elf/pr21964-1a.c b/ld/testsuite/ld-elf/pr21964-1a.c
index f2eae53552..680bda4dbf 100644
--- a/ld/testsuite/ld-elf/pr21964-1a.c
+++ b/ld/testsuite/ld-elf/pr21964-1a.c
@@ -1,6 +1,7 @@
 extern int __start___verbose[];
 extern int __stop___verbose[];
-int foo (void)
+int
+foo1 (void)
 {
   static int my_var __attribute__((used, section("__verbose"))) = 5;
   if (__start___verbose == __stop___verbose
diff --git a/ld/testsuite/ld-elf/pr21964-1b.c b/ld/testsuite/ld-elf/pr21964-1b.c
index 440c937f78..1507b22808 100644
--- a/ld/testsuite/ld-elf/pr21964-1b.c
+++ b/ld/testsuite/ld-elf/pr21964-1b.c
@@ -1,24 +1,12 @@
-#include <stdio.h>
-
-extern int foo (void);
-
 extern int __start___verbose[];
 extern int __stop___verbose[];
-static int my_var __attribute__((used, section("__verbose"))) = 6;
-int bar (void)
+int
+foo2 (void)
 {
-  if (__start___verbose == __stop___verbose)
+  static int my_var __attribute__((used, section("__verbose"))) = 10;
+  if (__start___verbose == __stop___verbose
+      || __start___verbose[0] != 10)
     return -1;
-
-  if (__start___verbose[0] != 6)
-    return -2;
   else
     return 0;
 }
-
-int main()
-{
-  if (bar () == 0 && foo () == 0)
-    printf ("PASS\n");
-  return 0;
-}
diff --git a/ld/testsuite/ld-elf/pr21964-1c.c b/ld/testsuite/ld-elf/pr21964-1c.c
new file mode 100644
index 0000000000..996a9e182f
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21964-1c.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+
+extern int foo1 (void);
+extern int foo2 (void);
+
+extern int __start___verbose[];
+extern int __stop___verbose[];
+static int my_var __attribute__((used, section("__verbose"))) = 6;
+int
+bar (void)
+{
+  if (__start___verbose == __stop___verbose)
+    return -1;
+
+  if (__start___verbose[0] != 6)
+    return -2;
+  else
+    return 0;
+}
+
+int
+main ()
+{
+  if (bar () == 0
+      && foo1 () == 0
+      && foo2 () == 0)
+    printf ("PASS\n");
+  return 0;
+}
diff --git a/ld/testsuite/ld-elf/pr21964-2a.c b/ld/testsuite/ld-elf/pr21964-2a.c
index 617ce75eea..6331ff063b 100644
--- a/ld/testsuite/ld-elf/pr21964-2a.c
+++ b/ld/testsuite/ld-elf/pr21964-2a.c
@@ -1,6 +1,7 @@
 extern int __start___verbose[];
 extern int __stop___verbose[];
-int foo (void)
+int
+foo1 (void)
 {
   static int my_var __attribute__((used, section("__verbose"))) = 5;
   if (__start___verbose == __stop___verbose
diff --git a/ld/testsuite/ld-elf/pr21964-2b.c b/ld/testsuite/ld-elf/pr21964-2b.c
index 5f638a3dec..1507b22808 100644
--- a/ld/testsuite/ld-elf/pr21964-2b.c
+++ b/ld/testsuite/ld-elf/pr21964-2b.c
@@ -1,27 +1,12 @@
-#include <dlfcn.h>
-#include <stdio.h>
-
-int main()
+extern int __start___verbose[];
+extern int __stop___verbose[];
+int
+foo2 (void)
 {
-  void *dl;
-  void *sym;
-  int (*func) (void);
-
-  dl = dlopen("pr21964-2.so", RTLD_LAZY);
-  if (!dl)
-    return 1;
-
-  sym = dlsym(dl, "__start___verbose");
-  if (!sym)
-    return 2;
-
-  func = dlsym(dl, "foo");
-  if (!func)
-    return 3;
-  if (func () == 0)
-    printf ("PASS\n");
-
-  dlclose(dl);
-
-  return 0;
+  static int my_var __attribute__((used, section("__verbose"))) = 10;
+  if (__start___verbose == __stop___verbose
+      || __start___verbose[0] != 10)
+    return -1;
+  else
+    return 0;
 }
diff --git a/ld/testsuite/ld-elf/pr21964-2c.c b/ld/testsuite/ld-elf/pr21964-2c.c
new file mode 100644
index 0000000000..f879dd5ba4
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21964-2c.c
@@ -0,0 +1,32 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+extern int foo1 (void);
+
+int main()
+{
+  void *dl;
+  void *sym;
+  int (*func) (void);
+
+  if (foo1 () != 0)
+    return 1;
+
+  dl = dlopen("pr21964-2b.so", RTLD_LAZY);
+  if (!dl)
+    return 2;
+
+  sym = dlsym(dl, "__start___verbose");
+  if (!sym)
+    return 3;
+
+  func = dlsym(dl, "foo2");
+  if (!func)
+    return 4;
+  if (func () == 0)
+    printf ("PASS\n");
+
+  dlclose(dl);
+
+  return 0;
+}
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 0802fa24c6..eee73778da 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -423,12 +423,18 @@ set build_tests {
   {"Build libpr19073.so"
    "-shared -Wl,--version-script=pr19073.map tmpdir/pr19073a.o" "-fPIC"
    {dummy.c} {{readelf {--dyn-syms --wide} pr19073.rd}} "libpr19073.so"}
-  {"Build pr21964-1.so"
+  {"Build pr21964-1a.so"
    "-shared" "-fPIC"
-   {pr21964-1a.c} {} "pr21964-1.so"}
-  {"Build pr21964-2.so"
+   {pr21964-1a.c} {} "pr21964-1a.so"}
+  {"Build pr21964-1b.so"
    "-shared" "-fPIC"
-   {pr21964-2a.c} {} "pr21964-2.so"}
+   {pr21964-1b.c} {} "pr21964-1b.so"}
+  {"Build pr21964-2a.so"
+   "-shared" "-fPIC"
+   {pr21964-2a.c} {} "pr21964-2a.so"}
+  {"Build pr21964-2b.so"
+   "-shared" "-fPIC"
+   {pr21964-2b.c} {} "pr21964-2b.so"}
 }
 
 run_cc_link_tests $build_tests
@@ -547,8 +553,8 @@ set run_tests [list \
      "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \
      {pr18458c.c} "pr18458" "pass.out" ] \
     [list "Run pr21964-1" \
-     "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1.so" "" \
-     {pr21964-1b.c} "pr21964-1" "pass.out" ] \
+     "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1a.so tmpdir/pr21964-1b.so" "" \
+     {pr21964-1c.c} "pr21964-1" "pass.out" ] \
 ]
 
 # NetBSD ELF systems do not currently support the .*_array sections.
@@ -596,8 +602,8 @@ set dlopen_run_tests [list \
      "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
      {dl6dmain.c} "dl6d1" "dl6b.out" ] \
     [list "Run pr21964-2" \
-     "-Wl,--no-as-needed,-rpath,tmpdir $extralibs" "" \
-     {pr21964-2b.c} "pr21964-2" "pass.out" ] \
+     "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-2a.so $extralibs" "" \
+     {pr21964-2c.c} "pr21964-2" "pass.out" ] \
 ]
 
 # Only run them when libdl is available.
-- 
2.13.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]