Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Previous test passed even without 1c32102.
  • Loading branch information
rui314 committed Aug 27, 2024
1 parent fe7237e commit d4c2073
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/arch-loongarch64-relax-call36.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

cat <<'EOF' | $CC -o $t/a.o -c -xassembler -
.globl foo, bar
.space 0x100000
foo:
move $s0, $ra
.reloc ., R_LARCH_CALL36, print
Expand All @@ -16,15 +17,17 @@ bar:
.reloc ., R_LARCH_RELAX
pcaddu18i $t0, 0
jirl $zero, $t0, 0
.space 0x100000
EOF

cat <<EOF | $CC -o $t/b.o -c -xc -
#include <stdio.h>
void foo();
void bar();
void print() __attribute__ ((section(".print")));
void print() {
printf("beef");
printf("foo");
}
int main() {
Expand All @@ -35,14 +38,14 @@ int main() {
EOF

$CC -B. -o $t/exe1 $t/a.o $t/b.o -Wl,--no-relax
$QEMU $t/exe1 | grep -q beefbeef
$QEMU $t/exe1 | grep -q foofoo

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

$CC -B. -o $t/exe2 $t/a.o $t/b.o -Wl,--relax -Wl,-Ttext=0x10000 -Wl,--section-start=.print=0x100000
$QEMU $t/exe2 | grep -q beefbeef
$CC -B. -o $t/exe2 $t/a.o $t/b.o -Wl,--relax
$QEMU $t/exe2 | grep -q foofoo

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

0 comments on commit d4c2073

Please sign in to comment.