#!/bin/bash export LC_ALL=C set -e CC="${CC:-cc}" CXX="${CXX:-c++}" GCC="${GCC:-gcc}" GXX="${GXX:-g++}" OBJDUMP="${OBJDUMP:-objdump}" MACHINE="${MACHINE:-$(uname -m)}" testname=$(basename "$0" .sh) echo -n "Testing $testname ... " cd "$(dirname "$0")"/../.. mold="$(pwd)/mold" t=out/test/elf/$testname mkdir -p $t cat < $t/c.map "$mold" -o $t/exe $t/a.o $t/b.o --version-script=$t/c.map readelf --symbols $t/exe > $t/log grep -Eq '0 NOTYPE LOCAL DEFAULT .* local1' $t/log grep -Eq '0 NOTYPE LOCAL DEFAULT .* local2' $t/log grep -Eq '0 NOTYPE GLOBAL DEFAULT .* foo' $t/log grep -Eq '0 NOTYPE GLOBAL DEFAULT .* bar' $t/log grep -Eq '0 NOTYPE GLOBAL DEFAULT .* this_is_global' $t/log grep -Eq '0 NOTYPE GLOBAL DEFAULT .* module_local' $t/log echo OK