1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 00:57:08 +03:00
mold/test/elf/arm32-hello-dynamic-arm.sh

33 lines
725 B
Bash
Executable File

#!/bin/bash
export LC_ALL=C
set -e
CC="${CC:-cc}"
CXX="${CXX:-c++}"
testname=$(basename "$0" .sh)
echo -n "Testing $testname ... "
cd "$(dirname "$0")"/../..
mold="$(pwd)/mold"
t=out/test/elf/$testname
mkdir -p $t
echo 'int main() {}' | arm-linux-gnueabihf-gcc -o $t/exe -xc - >& /dev/null \
|| { echo skipped; exit; }
which qemu-arm >& /dev/null || { echo skipped; exit; }
cat <<EOF | arm-linux-gnueabihf-gcc -o $t/a.o -c -g -xc - -fno-PIE -marm
#include <stdio.h>
int main() {
printf("Hello world\n");
return 0;
}
EOF
arm-linux-gnueabihf-gcc -B. -o $t/exe $t/a.o -no-pie
arm-linux-gnueabihf-readelf -p .comment $t/exe | grep -qw mold
qemu-arm -L /usr/arm-linux-gnueabihf $t/exe | grep -q 'Hello world'
echo OK