2006-10-18 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 18 Oct 2006 16:23:24 +0000 (16:23 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 18 Oct 2006 16:23:24 +0000 (16:23 +0000)
* ld-elf/dl4.c: New file.
* ld-elf/dl4.list: Likewise.
* ld-elf/dl4a.out: Likewise.
* ld-elf/dl4b.out: Likewise.
* ld-elf/dl4main.c: Likewise.
* ld-elf/dl4xxx.c: Likewise.
* ld-elf/dl4xxx.list: Likewise.

* ld-elf/shared.exp (build_tests): Add libdl4a.so and
libdl4b.so.
(run_tests): Likewise.

ld/testsuite/ChangeLog
ld/testsuite/ld-elf/dl4.c [new file with mode: 0644]
ld/testsuite/ld-elf/dl4.list [new file with mode: 0644]
ld/testsuite/ld-elf/dl4a.out [new file with mode: 0644]
ld/testsuite/ld-elf/dl4b.out [new file with mode: 0644]
ld/testsuite/ld-elf/dl4main.c [new file with mode: 0644]
ld/testsuite/ld-elf/dl4xxx.c [new file with mode: 0644]
ld/testsuite/ld-elf/dl4xxx.list [new file with mode: 0644]
ld/testsuite/ld-elf/shared.exp

index 89c147b09a496c87b7637fc407283d80ecbd8165..528e7b448ac1bbec46aafb30873645ecbd9569b4 100644 (file)
@@ -1,3 +1,17 @@
+2006-10-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ld-elf/dl4.c: New file.
+       * ld-elf/dl4.list: Likewise.
+       * ld-elf/dl4a.out: Likewise.
+       * ld-elf/dl4b.out: Likewise.
+       * ld-elf/dl4main.c: Likewise.
+       * ld-elf/dl4xxx.c: Likewise.
+       * ld-elf/dl4xxx.list: Likewise.
+
+       * ld-elf/shared.exp (build_tests): Add libdl4a.so and
+       libdl4b.so.
+       (run_tests): Likewise.
+
 2006-10-18  Richard Sandiford  <richard@codesourcery.com>
 
        * ld-mips-elf/reloc-1-n64.d: Match 16-character VMAs on LP64 hosts.
diff --git a/ld/testsuite/ld-elf/dl4.c b/ld/testsuite/ld-elf/dl4.c
new file mode 100644 (file)
index 0000000..bf6f070
--- /dev/null
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+int foo1;
+int foo2;
+
+extern void xxx1 (void);
+extern void xxx2 (void);
+
+void
+bar (int x)
+{
+  if (foo1 == 1)
+    printf ("bar OK1\n");
+  else if (foo1 == 0)
+    printf ("bar OK2\n");
+  if (foo2 == 1)
+    printf ("bar OK3\n");
+  else if (foo2 == 0)
+    printf ("bar OK4\n");
+  foo1 = -1;
+  foo2 = -1;
+  xxx1 ();
+  xxx2 ();
+}
diff --git a/ld/testsuite/ld-elf/dl4.list b/ld/testsuite/ld-elf/dl4.list
new file mode 100644 (file)
index 0000000..e932e23
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  foo1;
+  foo2;
+};
diff --git a/ld/testsuite/ld-elf/dl4a.out b/ld/testsuite/ld-elf/dl4a.out
new file mode 100644 (file)
index 0000000..871c5be
--- /dev/null
@@ -0,0 +1,6 @@
+bar OK1
+bar OK3
+DSO1
+DSO2
+OK1
+OK3
diff --git a/ld/testsuite/ld-elf/dl4b.out b/ld/testsuite/ld-elf/dl4b.out
new file mode 100644 (file)
index 0000000..b838f5b
--- /dev/null
@@ -0,0 +1,6 @@
+bar OK1
+bar OK3
+MAIN1
+MAIN2
+OK1
+OK3
diff --git a/ld/testsuite/ld-elf/dl4main.c b/ld/testsuite/ld-elf/dl4main.c
new file mode 100644 (file)
index 0000000..173450d
--- /dev/null
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+extern int foo1;
+extern int foo2;
+extern void bar (void);
+
+void
+xxx1 (void)
+{
+  printf ("MAIN1\n");
+}
+
+void
+xxx2 (void)
+{
+  printf ("MAIN2\n");
+}
+
+int
+main (void)
+{
+  foo1 = 1;
+  foo2 = 1;
+  bar ();
+  if (foo1 == -1)
+    printf ("OK1\n");
+  else if (foo1 == 1)
+    printf ("OK2\n");
+  if (foo2 == -1)
+    printf ("OK3\n");
+  else if (foo2 == 1)
+    printf ("OK4\n");
+  return 0;
+}
diff --git a/ld/testsuite/ld-elf/dl4xxx.c b/ld/testsuite/ld-elf/dl4xxx.c
new file mode 100644 (file)
index 0000000..8180eb1
--- /dev/null
@@ -0,0 +1,13 @@
+#include <stdio.h>
+
+void
+xxx1 (void)
+{
+  printf ("DSO1\n");
+}
+
+void
+xxx2 (void)
+{
+  printf ("DSO2\n");
+}
diff --git a/ld/testsuite/ld-elf/dl4xxx.list b/ld/testsuite/ld-elf/dl4xxx.list
new file mode 100644 (file)
index 0000000..f39ce14
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  xxx1;
+  xxx2;
+};
index 3090551f781897cce7be406f3f7b144bf177eae0..ff330a45002e298c5f3b6af9cbf5865a6c9d2b30 100644 (file)
@@ -75,6 +75,12 @@ set build_tests {
   {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list"
    "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC"
    {dl2.c dl2xxx.c} {} "libdl2b.so"}
+  {"Build libdl4a.so with --dynamic-list=dl4.list"
+   "-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
+   {dl4.c dl4xxx.c} {} "libdl4a.so"}
+  {"Build libdl4b.so with --dynamic-list=dl4.list and dl4xxx.list"
+   "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC"
+   {dl4.c dl4xxx.c} {} "libdl4b.so"}
 }
 
 set run_tests {
@@ -123,6 +129,12 @@ set run_tests {
     {"Run with libdl2b.so"
      "tmpdir/libdl2b.so" ""
      {dl2main.c} "dl2b" "dl2b.out"}
+    {"Run with libdl4a.so"
+     "tmpdir/libdl4a.so" ""
+     {dl4main.c} "dl4a" "dl4a.out"}
+    {"Run with libdl4b.so"
+     "tmpdir/libdl4b.so" ""
+     {dl4main.c} "dl4b" "dl4b.out"}
 }
 
 run_cc_link_tests $build_tests