2021-07-09 11:03:06 +03:00
|
|
|
#!/bin/bash
|
2021-12-17 14:05:14 +03:00
|
|
|
export LANG=
|
2021-07-09 11:03:06 +03:00
|
|
|
set -e
|
|
|
|
cd $(dirname $0)
|
2021-09-08 13:11:48 +03:00
|
|
|
mold=`pwd`/../../mold
|
2021-07-09 11:03:06 +03:00
|
|
|
echo -n "Testing $(basename -s .sh $0) ... "
|
2021-10-12 12:32:20 +03:00
|
|
|
t=$(pwd)/../../out/test/elf/$(basename -s .sh $0)
|
2021-07-09 11:03:06 +03:00
|
|
|
mkdir -p $t
|
|
|
|
|
|
|
|
echo 'VERSION { ver_x { global: *; }; };' > $t/a.script
|
|
|
|
|
|
|
|
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 $t/a.script $t/b.s
|
2021-07-09 11:03:06 +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
|
|
|
|
|
|
|
|
echo OK
|