diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/lib-nopic-01a.s | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/lib-nopic-01b.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-riscv-elf/lib-nopic-01b.s | 9 |
5 files changed, 43 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index f51e646..8fc2cee 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,16 @@ +2019-10-17 Nelson Chu <nelson.chu@sifive.com> + + * testsuite/ld-riscv-elf/lib-nopic-01b.d: Update the error message. + + * testsuite/ld-riscv-elf/lib-nopic-01a.s: Create the shared library + lib-nopic-01a.so, it will be linked with lib-nopic-01b.s. + * testsuite/ld-riscv-elf/lib-nopic-01b.s: Add new test for the + unresolved relocation. Link the non-pic code into a shared library + may cause the error. + * testsuite/ld-riscv-elf/lib-nopic-01b.d: Likewise. + * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run the new test only when + the shared library is supported. + 2019-10-16 Alan Modra <amodra@gmail.com> PR 13616 diff --git a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp index c994a57..0a7ac59 100644 --- a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp +++ b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp @@ -71,4 +71,11 @@ if [istarget "riscv*-*-*"] { [list "readelf --syms gp-test.sd"] \ "gp-test-${abi}"]] } + + run_ld_link_tests { + { "Link non-pic code into a shared library (setup)" + "-shared" "" "" {lib-nopic-01a.s} + {} "lib-nopic-01a.so" } + } + run_dump_test "lib-nopic-01b" } diff --git a/ld/testsuite/ld-riscv-elf/lib-nopic-01a.s b/ld/testsuite/ld-riscv-elf/lib-nopic-01a.s new file mode 100644 index 0000000..c95cda0 --- /dev/null +++ b/ld/testsuite/ld-riscv-elf/lib-nopic-01a.s @@ -0,0 +1,9 @@ + .option nopic + .text + .align 1 + .globl func1 + .type func1, @function +func1: + call func2 + jr ra + .size func1, .-func1 diff --git a/ld/testsuite/ld-riscv-elf/lib-nopic-01b.d b/ld/testsuite/ld-riscv-elf/lib-nopic-01b.d new file mode 100644 index 0000000..0d758a4 --- /dev/null +++ b/ld/testsuite/ld-riscv-elf/lib-nopic-01b.d @@ -0,0 +1,5 @@ +#name: link non-pic code into a shared library +#source: lib-nopic-01b.s +#as: +#ld: -shared tmpdir/lib-nopic-01a.so +#error: .*relocation R_RISCV_CALL against `func1' can not be used when making a shared object; recompile with -fPIC diff --git a/ld/testsuite/ld-riscv-elf/lib-nopic-01b.s b/ld/testsuite/ld-riscv-elf/lib-nopic-01b.s new file mode 100644 index 0000000..97fe137 --- /dev/null +++ b/ld/testsuite/ld-riscv-elf/lib-nopic-01b.s @@ -0,0 +1,9 @@ + .option nopic + .text + .align 1 + .globl func2 + .type func2, @function +func2: + call func1 + jr ra + .size func2, .-func2 |