Skip to content

Commit 6452395

Browse files
committed
Revert "[lld][test][LoongArch] Remove the test for R_LARCH_CALL36 range checking"
This reverts commit 0fbc728. In 88548df, both the .sec.foo and .tex sections used the same section flags, hence sharing one segment, pushing the output file size too large. This breaks on many buildbots. Now assign section .sec.foo different flags ("awx") from .text ("ax") so that both sections get their own segment.
1 parent 9fba1d5 commit 6452395

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lld/test/ELF/loongarch-call36.s

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
# GOTPLT-NEXT: 0x01274730 00000000 00000000 00000000 00000000
4141
# GOTPLT-NEXT: 0x01274740 00452301 00000000
4242

43+
# RUN: not ld.lld %t/a.o --section-start=.text=0x20000 --section-start=.sec.foo=0x2000020000 -o /dev/null 2>&1 | \
44+
# RUN: FileCheck -DFILE=%t/a.o --check-prefix=ERROR-RANGE %s
45+
# ERROR-RANGE: error: [[FILE]]:(.text+0x0): relocation R_LARCH_CALL36 out of range: 137438953472 is not in [-137439084544, 137438822399]; references 'foo'
46+
4347
## Impossible case in reality becasue all LoongArch instructions are fixed 4-bytes long.
4448
# RUN: not ld.lld %t/a.o --section-start=.text=0x20000 --section-start=.sec.foo=0x40001 -o /dev/null 2>&1 | \
4549
# RUN: FileCheck -DFILE=%t/a.o --check-prefix=ERROR-ALIGN %s
@@ -59,7 +63,7 @@ _start:
5963
pcaddu18i $t0, 0
6064
jirl $zero, $t0, 0
6165

62-
.section .sec.foo,"ax"
66+
.section .sec.foo,"awx"
6367
.global foo
6468
foo:
6569
ret

0 commit comments

Comments
 (0)