mirror of
https://github.com/rui314/mold.git
synced 2024-11-15 14:36:25 +03:00
c50dd18881
We sometimes put local symbols into .dynsym, but if they are global symbols hidden by a version script, they were exported from .dynsym. This patch correctly makes them local symbols.
34 lines
631 B
Bash
Executable File
34 lines
631 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
cd $(dirname $0)
|
|
mold=`pwd`/../mold
|
|
echo -n "Testing $(basename -s .sh $0) ... "
|
|
t=$(pwd)/tmp/$(basename -s .sh $0)
|
|
mkdir -p $t
|
|
|
|
if [ $(uname -m) = x86_64 ]; then
|
|
dialect=gnu
|
|
elif [ $(uname -m) = aarch64 ]; then
|
|
dialect=trad
|
|
else
|
|
echo skipped
|
|
exit 0
|
|
fi
|
|
|
|
echo '{ global: bar; local: *; };' > $t/a.ver
|
|
|
|
cat <<EOF | gcc -mtls-dialect=$dialect -fPIC -c -o $t/b.o -xc -
|
|
_Thread_local int foo;
|
|
|
|
int bar() {
|
|
return foo;
|
|
}
|
|
EOF
|
|
|
|
clang -fuse-ld=$mold -shared -o $t/c.so $t/b.o -Wl,--version-script=$t/a.ver \
|
|
-Wl,--no-relax
|
|
|
|
readelf -W --dyn-syms $t/c.so | grep -Pq 'TLS LOCAL DEFAULT \d+ foo'
|
|
|
|
echo OK
|