mirror of
https://github.com/rui314/mold.git
synced 2024-10-05 00:57:08 +03:00
32 lines
586 B
Bash
Executable File
32 lines
586 B
Bash
Executable File
#!/bin/bash
|
|
export LANG=
|
|
set -e
|
|
CC="${CC:-cc}"
|
|
CXX="${CXX:-c++}"
|
|
testname=$(basename -s .sh "$0")
|
|
echo -n "Testing $testname ... "
|
|
cd "$(dirname "$0")"/../..
|
|
mold="$(pwd)/mold"
|
|
t="$(pwd)/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
|