1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 00:57:08 +03:00
mold/test/protected-dynsym.sh
2021-07-07 20:38:48 +09:00

20 lines
431 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 | cc -fPIC -c -o $t/a.o -xc -
extern int foo;
EOF
cat <<EOF | cc -fPIC -c -o $t/b.o -xc -
__attribute__((visibility("protected"))) int foo;
EOF
clang -fuse-ld=`pwd`/../mold -shared -o $t/c.so $t/a.o $t/b.o -Wl,-strip-all
readelf --symbols $t/c.so | grep -Pq 'PROTECTED\b.*\bfoo\b'
echo OK