1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-15 14:36:25 +03:00

Add a test

This commit is contained in:
Rui Ueyama 2021-07-07 20:38:48 +09:00
parent 048a478bab
commit e3dccd0157

19
test/protected-dynsym.sh Executable file
View File

@ -0,0 +1,19 @@
#!/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