2021-03-25 12:38:25 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cd $(dirname $0)
|
|
|
|
echo -n "Testing $(basename -s .sh $0) ... "
|
|
|
|
t=$(pwd)/tmp/$(basename -s .sh $0)
|
|
|
|
mkdir -p $t
|
|
|
|
|
|
|
|
cat <<'EOF' | cc -xc -c -o $t/a.o -
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
printf("Hello\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2021-07-12 05:27:05 +03:00
|
|
|
gcc -fuse-ld=bfd -o $t/exe $t/a.o
|
2021-03-25 12:38:25 +03:00
|
|
|
readelf -p .comment $t/exe > $t/log
|
2021-04-11 07:58:49 +03:00
|
|
|
! grep -q mold $t/log || false
|
2021-03-25 12:38:25 +03:00
|
|
|
|
2021-07-12 05:27:05 +03:00
|
|
|
clang -fuse-ld=bfd -o $t/exe $t/a.o
|
2021-03-25 12:38:25 +03:00
|
|
|
readelf -p .comment $t/exe > $t/log
|
2021-04-11 07:58:49 +03:00
|
|
|
! grep -q mold $t/log || false
|
2021-03-25 12:38:25 +03:00
|
|
|
|
2021-06-04 14:32:58 +03:00
|
|
|
LD_PRELOAD=`pwd`/../mold-wrapper.so MOLD_PATH=`pwd`/../mold \
|
2021-07-03 07:25:10 +03:00
|
|
|
gcc -o $t/exe $t/a.o -B/usr/bin
|
2021-03-25 12:38:25 +03:00
|
|
|
readelf -p .comment $t/exe > $t/log
|
2021-04-10 17:08:55 +03:00
|
|
|
grep -q mold $t/log
|
2021-03-25 12:38:25 +03:00
|
|
|
|
2021-06-04 14:32:58 +03:00
|
|
|
LD_PRELOAD=`pwd`/../mold-wrapper.so MOLD_PATH=`pwd`/../mold \
|
2021-07-03 07:25:10 +03:00
|
|
|
clang -o $t/exe $t/a.o -fuse-ld=/usr/bin/ld
|
2021-03-25 12:38:25 +03:00
|
|
|
readelf -p .comment $t/exe > $t/log
|
2021-04-10 17:08:55 +03:00
|
|
|
grep -q mold $t/log
|
2021-03-25 12:38:25 +03:00
|
|
|
|
2021-06-04 14:32:58 +03:00
|
|
|
../mold -run env | grep -q '^MOLD_PATH=.*/mold$'
|
2021-05-10 10:40:47 +03:00
|
|
|
|
2021-05-14 16:55:04 +03:00
|
|
|
../mold -run /usr/bin/ld --version | grep -q mold
|
2021-05-20 08:12:59 +03:00
|
|
|
../mold -run /usr/bin/ld.lld --version | grep -q mold
|
|
|
|
../mold -run /usr/bin/ld.gold --version | grep -q mold
|
2021-05-14 16:55:04 +03:00
|
|
|
|
2021-03-25 12:38:25 +03:00
|
|
|
echo OK
|