1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-15 14:36:25 +03:00
mold/test/elf/interpose.sh
2021-09-08 19:13:18 +09:00

21 lines
405 B
Bash
Executable File

#!/bin/bash
set -e
cd $(dirname $0)
mold=`pwd`/../../mold
echo -n "Testing $(basename -s .sh $0) ... "
t=$(pwd)/../..//out/test/elf/$(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=$mold -shared -o $t/b.so $t/a.o -Wl,-z,interpose
readelf --dynamic $t/b.so | grep -q 'Flags: INTERPOSE'
echo OK