From 13ffdac36f589830863b10c760b79ab7809e1b12 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 5 May 2021 10:35:31 +0930 Subject: [PATCH] PowerPC undefweak testcase 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 | 7 +++++++ ld/testsuite/ld-powerpc/empty.s | 0 ld/testsuite/ld-powerpc/powerpc.exp | 3 +++ ld/testsuite/ld-powerpc/undefweak.d | 10 ++++++++++ ld/testsuite/ld-powerpc/undefweak.s | 8 ++++++++ 5 files changed, 28 insertions(+) create mode 100644 ld/testsuite/ld-powerpc/empty.s create mode 100644 ld/testsuite/ld-powerpc/undefweak.d create mode 100644 ld/testsuite/ld-powerpc/undefweak.s diff --git a/ld/ChangeLog b/ld/ChangeLog index ebd7ac1c980..52629384aba 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2021-05-05 Alan Modra + + * 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 * 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 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 -- 2.30.2