binutils-gdb/ld/testsuite/ld-loongarch-elf/relax-separate-code-overflow.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

21 lines
413 B
ArmAsm

# ld -z separate-code let .text and .rodata in two segment,
# need to consider segment alignment
.text
# first two la.local relax in the second trip, and result in the third
# la.local (relax to pcaddi) overflow
la.local $r12, a
la.local $r12, b
.fill 0x3ff8
# relax in the first trip
la.local $r12, c
.fill 0x1fbfec
a:
.fill 8
b:
.fill 0x1000
d:
.fill 0x1
.section .rodata
c:
.8byte 0x1