1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-11 05:46:58 +03:00
mold/test/now.sh
Rui Ueyama 4da18565f5 wip
2021-04-11 14:01:00 +09:00

24 lines
512 B
Bash
Executable File

#!/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 | clang -c -fPIC -o $t/a.o -xc -
#include <stdio.h>
void foo() {
printf("Hello world\n");
}
EOF
clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o -Wl,-z,now
readelf --dynamic $t/b.so | grep -q 'Flags: NOW'
clang -fuse-ld=`pwd`/../mold -shared -o $t/b.so $t/a.o -Wl,-z,now,-z,lazy
readelf --dynamic $t/b.so > $t/log
! grep -q 'Flags: NOW' $t/log || false
echo OK