1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-06 01:28:12 +03:00

Merge pull request #252 from sicherha/fix-tests-on-aarch64

Fix test failures on aarch64
This commit is contained in:
Rui Ueyama 2022-01-05 21:07:26 +09:00 committed by GitHub
commit 3865a10600
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 4 deletions

View File

@ -8,6 +8,19 @@ mold="$(pwd)/mold"
t="$(pwd)/out/test/elf/$testname" t="$(pwd)/out/test/elf/$testname"
mkdir -p "$t" 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 - cat <<EOF | cc -o "$t"/a.o -c -x assembler -
.globl foo, bar .globl foo, bar
foo: foo:
@ -18,14 +31,14 @@ EOF
"$mold" -e foo -static -o "$t"/exe "$t"/a.o "$mold" -e foo -static -o "$t"/exe "$t"/a.o
readelf -e "$t"/exe > "$t"/log 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 "$mold" -e bar -static -o "$t"/exe "$t"/a.o
readelf -e "$t"/exe > "$t"/log 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 "$mold" -static -o "$t"/exe "$t"/a.o
readelf -e "$t"/exe > "$t"/log readelf -e "$t"/exe > "$t"/log
grep -q 'Entry point address:.*0x201000' "$t"/log grep -q "Entry point address:.*$base" "$t"/log
echo OK echo OK

View File

@ -8,8 +8,21 @@ mold="$(pwd)/mold"
t="$(pwd)/out/test/elf/$testname" t="$(pwd)/out/test/elf/$testname"
mkdir -p "$t" 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 - cat <<EOF | cc -o "$t"/a.o -c -x assembler -
foo: jmp 0 foo: $jump 0
EOF EOF
cat <<EOF | cc -o "$t"/b.o -c -xc - cat <<EOF | cc -o "$t"/b.o -c -xc -