PowerPC undefweak testcase
authorAlan Modra <amodra@gmail.com>
Wed, 5 May 2021 01:05:31 +0000 (10:35 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 5 May 2021 01:05:31 +0000 (10:35 +0930)
Test for commit 4916030821bb and b293661219c3.

* testsuite/ld-powerpc/empty.s: New file.
* testsuite/ld-powerpc/undefweak.d,
* testsuite/ld-powerpc/undefweak.s: New testcase.
* testsuite/ld-powerpc/powerpc.exp: Run it.

ld/ChangeLog
ld/testsuite/ld-powerpc/empty.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/powerpc.exp
ld/testsuite/ld-powerpc/undefweak.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/undefweak.s [new file with mode: 0644]

index ebd7ac1c980628858879cccdd55a86bdf685ded4..52629384aba437ce07584894e71a24a0f69c23a8 100644 (file)
@@ -1,3 +1,10 @@
+2021-05-05  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-powerpc/empty.s: New file.
+       * testsuite/ld-powerpc/undefweak.d,
+       * testsuite/ld-powerpc/undefweak.s: New testcase.
+       * testsuite/ld-powerpc/powerpc.exp: Run it.
+
 2021-05-03  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-s390/tlspic_64.rd: Adjust expected output for
diff --git a/ld/testsuite/ld-powerpc/empty.s b/ld/testsuite/ld-powerpc/empty.s
new file mode 100644 (file)
index 0000000..e69de29
index 2ac02b1c02bf4dbfee3efcfd48fe94b132910abe..f15f64e38523c8fc931988e8a9b973340108b89d 100644 (file)
@@ -172,6 +172,7 @@ set ppcelftests {
     {"relocatable relaxing large" "-melf32ppc -r --relax" "" "-a32" "relax.s big.s"
      {{objdump -dr relaxrl.d}}
      "rrelax"}
+    {"build empty shared library" "-shared" "" "" "empty.s" {} "empty.so"}
 }
 
 set ppc64elftests {
@@ -487,3 +488,5 @@ run_dump_test "non-contiguous-powerpc"
 
 run_dump_test "tprel32"
 run_dump_test "tprelbad"
+
+run_dump_test "undefweak"
diff --git a/ld/testsuite/ld-powerpc/undefweak.d b/ld/testsuite/ld-powerpc/undefweak.d
new file mode 100644 (file)
index 0000000..3c4a18f
--- /dev/null
@@ -0,0 +1,10 @@
+#ld: tmpdir/empty.so
+#readelf: --dyn-syms -r -W
+
+#...
+.* R_PPC(|64)_ADDR(32|64) .* a \+ 0
+#...
+.* R_PPC(|64)_JMP_SLOT .* b \+ 0
+#...
+.* WEAK +DEFAULT +UND b
+.* WEAK +DEFAULT +UND a
diff --git a/ld/testsuite/ld-powerpc/undefweak.s b/ld/testsuite/ld-powerpc/undefweak.s
new file mode 100644 (file)
index 0000000..e6eb1b4
--- /dev/null
@@ -0,0 +1,8 @@
+ .weak a,b
+ .data
+ .dc.a a
+ .text
+ .global _start
+_start:
+ bl b
+ nop