2021-03-05 13:38:37 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2021-07-19 18:21:12 +03:00
|
|
|
mold=$1
|
2021-03-05 13:38:37 +03:00
|
|
|
cd $(dirname $0)
|
|
|
|
echo -n "Testing $(basename -s .sh $0) ... "
|
|
|
|
t=$(pwd)/tmp/$(basename -s .sh $0)
|
|
|
|
mkdir -p $t
|
|
|
|
|
|
|
|
echo 'ver_x { global: *; };' > $t/a.ver
|
|
|
|
|
|
|
|
cat <<EOF > $t/b.s
|
|
|
|
.globl foo, bar, baz
|
|
|
|
foo:
|
|
|
|
nop
|
|
|
|
bar:
|
|
|
|
nop
|
|
|
|
baz:
|
|
|
|
nop
|
|
|
|
EOF
|
|
|
|
|
2021-07-19 18:21:12 +03:00
|
|
|
clang -fuse-ld=$mold -shared -o $t/c.so -Wl,-version-script,$t/a.ver $t/b.s
|
2021-03-07 07:43:58 +03:00
|
|
|
readelf --version-info $t/c.so > $t/log
|
|
|
|
|
|
|
|
fgrep -q 'Rev: 1 Flags: none Index: 2 Cnt: 1 Name: ver_x' $t/log
|
2021-03-05 13:38:37 +03:00
|
|
|
|
|
|
|
echo OK
|