aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-loongarch-elf/relax-medium-call-1.s
diff options
context:
space:
mode:
authormengqinggang <mengqinggang@loongson.cn>2024-05-22 14:27:08 +0800
committerliuzhensong <liuzhensong@loongson.cn>2024-05-27 17:41:04 +0800
commit6f779908fd6d7c85197ab13949a9dc5e6d4f1458 (patch)
tree00725fade1e0d17330a79b2b5a8aa10cae0edb14 /ld/testsuite/ld-loongarch-elf/relax-medium-call-1.s
parent4250085217f2011335257fd3291cb50c939e9746 (diff)
downloadbinutils-6f779908fd6d7c85197ab13949a9dc5e6d4f1458.zip
binutils-6f779908fd6d7c85197ab13949a9dc5e6d4f1458.tar.gz
binutils-6f779908fd6d7c85197ab13949a9dc5e6d4f1458.tar.bz2
LoongArch: Fix relaxation overflow caused by ld -z separate-code
ld -z separate-code let .text and .rodata in two different but read only segment. If the symbol and pc in two segment, the offset from pc to symbol need to consider segment alignment. Add a function 'loongarch_two_sections_in_same_segment' to determine whether two sections are in the same segment.
Diffstat (limited to 'ld/testsuite/ld-loongarch-elf/relax-medium-call-1.s')
-rw-r--r--ld/testsuite/ld-loongarch-elf/relax-medium-call-1.s6
1 files changed, 3 insertions, 3 deletions
diff --git a/ld/testsuite/ld-loongarch-elf/relax-medium-call-1.s b/ld/testsuite/ld-loongarch-elf/relax-medium-call-1.s
index 5266fda..1770ec9 100644
--- a/ld/testsuite/ld-loongarch-elf/relax-medium-call-1.s
+++ b/ld/testsuite/ld-loongarch-elf/relax-medium-call-1.s
@@ -1,12 +1,12 @@
-.section "ta", "ax"
+.text
a:
ret
ret
ret
b:
ret
+ .fill 0x7fffff0
-.text
pcaddu18i $ra, %call36(a) # min offset, can relax
jirl $ra, $ra, 0
pcaddu18i $ra, %call36(a) # overflow, not relax
@@ -25,7 +25,7 @@ b:
pcaddu18i $t0, %call36(d) # max offset, can relax
jirl $zero, $t0, 0
-.section "tb", "ax"
+ .fill 0x7ffffc8
ret
ret
ret