2021-03-25 12:02:42 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
cd $(dirname $0)
|
2021-09-08 13:11:48 +03:00
|
|
|
mold=`pwd`/../../mold
|
2021-03-25 12:02:42 +03:00
|
|
|
echo -n "Testing $(basename -s .sh $0) ... "
|
2021-10-12 12:32:20 +03:00
|
|
|
t=$(pwd)/../../out/test/elf/$(basename -s .sh $0)
|
2021-03-25 12:02:42 +03:00
|
|
|
mkdir -p $t
|
|
|
|
|
|
|
|
cat <<'EOF' | cc -x assembler -c -o $t/a.o -Wa,--keep-locals -
|
|
|
|
.globl _start, foo
|
|
|
|
_start:
|
|
|
|
foo:
|
|
|
|
bar:
|
|
|
|
.L.baz:
|
|
|
|
EOF
|
|
|
|
|
2021-07-19 18:21:12 +03:00
|
|
|
$mold -o $t/exe $t/a.o
|
2021-03-25 12:02:42 +03:00
|
|
|
readelf --symbols $t/exe > $t/log
|
|
|
|
fgrep -q _start $t/log
|
|
|
|
fgrep -q foo $t/log
|
|
|
|
fgrep -q bar $t/log
|
|
|
|
fgrep -q .L.baz $t/log
|
|
|
|
|
2021-07-19 18:21:12 +03:00
|
|
|
$mold -o $t/exe $t/a.o -strip-all
|
2021-03-25 12:02:42 +03:00
|
|
|
readelf --symbols $t/exe > $t/log
|
2021-04-11 07:58:49 +03:00
|
|
|
! fgrep -q _start $t/log || false
|
|
|
|
! fgrep -q foo $t/log || false
|
|
|
|
! fgrep -q bar $t/log || false
|
|
|
|
! fgrep -q .L.baz $t/log || false
|
2021-03-25 12:02:42 +03:00
|
|
|
|
|
|
|
echo OK
|