PowerPC undefweak testcase

Message ID 20210505021612.GO22624@bubble.grove.modra.org
State New
Headers show
Series
  • PowerPC undefweak testcase
Related show

Commit Message

H.J. Lu via Binutils May 5, 2021, 2:16 a.m.
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.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/ld/testsuite/ld-powerpc/empty.s b/ld/testsuite/ld-powerpc/empty.s
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 2ac02b1c02b..f15f64e3852 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -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
index 00000000000..3c4a18ff856
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/undefweak.d
@@ -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
index 00000000000..e6eb1b44b82
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/undefweak.s
@@ -0,0 +1,8 @@ 
+ .weak a,b
+ .data
+ .dc.a a
+ .text
+ .global _start
+_start:
+ bl b
+ nop