Skip to content

Commit

Permalink
Fix test failures on aarch64
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Erhardt <[email protected]>
  • Loading branch information
sicherha committed Jan 5, 2022
1 parent be49d67 commit df86572
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
19 changes: 16 additions & 3 deletions test/elf/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ mold="$(pwd)/mold"
t="$(pwd)/out/test/elf/$testname"
mkdir -p "$t"

case "$(uname -m)" in
i386 | i686 | x86_64)
base=0x201000
;;
aarch64)
base=0x210000
;;
*)
echo skipped
exit 0
;;
esac

cat <<EOF | cc -o "$t"/a.o -c -x assembler -
.globl foo, bar
foo:
Expand All @@ -18,14 +31,14 @@ EOF

"$mold" -e foo -static -o "$t"/exe "$t"/a.o
readelf -e "$t"/exe > "$t"/log
grep -q 'Entry point address:.*0x201000' "$t"/log
grep -q "Entry point address:.*$base" "$t"/log

"$mold" -e bar -static -o "$t"/exe "$t"/a.o
readelf -e "$t"/exe > "$t"/log
grep -q 'Entry point address:.*0x201008' "$t"/log
grep -q "$(printf 'Entry point address:.*0x%x' $((base + 8)))" "$t"/log

"$mold" -static -o "$t"/exe "$t"/a.o
readelf -e "$t"/exe > "$t"/log
grep -q 'Entry point address:.*0x201000' "$t"/log
grep -q "Entry point address:.*$base" "$t"/log

echo OK
15 changes: 14 additions & 1 deletion test/elf/reloc-zero.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ mold="$(pwd)/mold"
t="$(pwd)/out/test/elf/$testname"
mkdir -p "$t"

case "$(uname -m)" in
i386 | i686 | x86_64)
jump=jmp
;;
aarch64)
jump=b
;;
*)
echo skipped
exit 0
;;
esac

cat <<EOF | cc -o "$t"/a.o -c -x assembler -
foo: jmp 0
foo: $jump 0
EOF

cat <<EOF | cc -o "$t"/b.o -c -xc -
Expand Down

0 comments on commit df86572

Please sign in to comment.