Skip to content

Commit 4da257e

Browse files
committed
LoongArch: change test of R_LARCH_CALL36 with bigger offset
1 parent 1c32102 commit 4da257e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/arch-loongarch64-relax-call36.sh

+9-7
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ cat <<'EOF' | $CC -o $t/a.o -c -xassembler -
55
.globl foo, bar
66
foo:
77
move $s0, $ra
8-
.reloc ., R_LARCH_CALL36, foo2
8+
.reloc ., R_LARCH_CALL36, print
99
.reloc ., R_LARCH_RELAX
1010
pcaddu18i $t0, 0
1111
jirl $ra, $t0, 0
1212
move $ra, $s0
1313
ret
1414
bar:
15-
.reloc ., R_LARCH_CALL36, bar2
15+
.reloc ., R_LARCH_CALL36, print
1616
.reloc ., R_LARCH_RELAX
1717
pcaddu18i $t0, 0
1818
jirl $zero, $t0, 0
@@ -22,8 +22,10 @@ cat <<EOF | $CC -o $t/b.o -c -xc -
2222
#include <stdio.h>
2323
void foo();
2424
void bar();
25-
void foo2() { printf("foo"); }
26-
void bar2() { printf("bar"); }
25+
void print() __attribute__ ((section(".print")));
26+
void print() {
27+
printf("beef");
28+
}
2729
2830
int main() {
2931
foo();
@@ -33,14 +35,14 @@ int main() {
3335
EOF
3436

3537
$CC -B. -o $t/exe1 $t/a.o $t/b.o -Wl,--no-relax
36-
$QEMU $t/exe1 | grep -q foobar
38+
$QEMU $t/exe1 | grep -q beefbeef
3739

3840
$OBJDUMP -d $t/exe1 > $t/exe1.objdump
3941
grep -A2 '<foo>:' $t/exe1.objdump | grep -wq pcaddu18i
4042
grep -A2 '<bar>:' $t/exe1.objdump | grep -wq pcaddu18i
4143

42-
$CC -B. -o $t/exe2 $t/a.o $t/b.o -Wl,--relax
43-
$QEMU $t/exe2 | grep -q foobar
44+
$CC -B. -o $t/exe2 $t/a.o $t/b.o -Wl,--relax -Wl,-Ttext=0x10000 -Wl,--section-start=.print=0x100000
45+
$QEMU $t/exe2 | grep -q beefbeef
4446

4547
$OBJDUMP -d $t/exe2 > $t/exe2.objdump
4648
grep -A2 '<foo>:' $t/exe2.objdump | grep -wq bl

0 commit comments

Comments
 (0)