binutils-gdb/ld/testsuite/ld-loongarch-elf/relax-medium-call.s
mengqinggang 6f779908fd 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.
2024-05-27 17:41:04 +08:00

36 lines
445 B
ArmAsm

.text
a:
ret
ret
ret
b:
ret
.fill 0x7fffff0
call36 a # min offset, can relax
call36 a # overflow, not relax
tail36 $t0, b # min offset, can relax
tail36 $t0, b # overflow, not relax
call36 c # overflow, not relax
call36 c # max offset, can relax
tail36 $t0, d # overflow, no relax
tail36 $t0, d # max offset, can relax
.fill 0x7ffffc8
ret
ret
ret
ret
ret
ret
ret
ret
c:
ret
ret
ret
d:
ret