mirror of
https://github.com/rui314/mold.git
synced 2024-11-15 14:36:25 +03:00
20 lines
431 B
Bash
20 lines
431 B
Bash
|
#!/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
|