From dc5f359ed6a36d2c895d89c3e4886f3a2b6d9232 Mon Sep 17 00:00:00 2001 From: mengqinggang Date: Thu, 28 Sep 2023 16:41:15 +0800 Subject: LoongArch: Add new relocation R_LARCH_CALL36 R_LARCH_CALL36 is used for medium code model function call pcaddu18i+jirl, and these two instructions must adjacent. The LoongArch ABI v2.20 at here: https://github.com/loongson/la-abi-specs. --- ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp | 12 ++++++++++++ ld/testsuite/ld-loongarch-elf/medium-call.s | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 ld/testsuite/ld-loongarch-elf/medium-call.s (limited to 'ld') diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp index b95cc53..1fc70d0 100644 --- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp +++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp @@ -55,4 +55,16 @@ if [istarget "loongarch64-*-*"] { "64_pcrel" \ ] \ ] + + run_ld_link_tests \ + [list \ + [list \ + "medium code model call" \ + "-e 0x0" "" \ + "" \ + {medium-call.s} \ + {} \ + "medium-call" \ + ] \ + ] } diff --git a/ld/testsuite/ld-loongarch-elf/medium-call.s b/ld/testsuite/ld-loongarch-elf/medium-call.s new file mode 100644 index 0000000..4d1888b --- /dev/null +++ b/ld/testsuite/ld-loongarch-elf/medium-call.s @@ -0,0 +1,7 @@ +.L1: + # call .L1, r1(ra) temp register, r1(ra) return register. + pcaddu18i $r1, %call36(.L1) + jirl $r1, $r1, 0 + # tail .L1, r12(t0) temp register, r0(zero) return register. + pcaddu18i $r12, %call36(.L1) + jirl $r0, $r12, 0 -- cgit v1.1