1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-05 00:57:08 +03:00
mold/test/elf/version-script10.sh
2022-01-24 10:21:08 +09:00

32 lines
552 B
Bash
Executable File

#!/bin/bash
export LANG=
set -e
CC="${CC:-cc}"
CXX="${CXX:-c++}"
testname=$(basename "$0" .sh)
echo -n "Testing $testname ... "
cd "$(dirname "$0")"/../..
mold="$(pwd)/mold"
t=out/test/elf/$testname
mkdir -p $t
echo 'VER1 { foo[12]; }; VER2 {};' > $t/a.ver
cat <<EOF > $t/b.s
.globl foo1, foo2, foo3
foo1:
nop
foo2:
nop
foo3:
nop
EOF
$CC -B. -shared -o $t/c.so -Wl,-version-script,$t/a.ver $t/b.s
readelf --dyn-syms $t/c.so > $t/log
grep -q ' foo1@@VER1$' $t/log
grep -q ' foo2@@VER1$' $t/log
! grep -q ' foo3@@VER1$' $t/log || false
echo OK