diff --git a/tests/elf/export-dynamic-static.sh b/tests/elf/export-dynamic-static.sh index bd68261dd..7dc093de9 100755 --- a/tests/elf/export-dynamic-static.sh +++ b/tests/elf/export-dynamic-static.sh @@ -3,7 +3,11 @@ # A statically-linked executable that exports symbols has .dynamic and # .dynsym. -test_cflags -static || skip +test_cflags -static -no-pie || skip + +# FreeBSD's libc assumes that a program is dynamically linked if _DYNAMIC +# is defined, so it doesn't support a static executable with .dynamic. +[ "$(uname)" = FreeBSD ] && skip cat < @@ -13,14 +17,14 @@ int main() { } EOF -$CC -B. -o $t/exe1 $t/a.o -static -Wl,--export-dynamic +$CC -B. -o $t/exe1 $t/a.o -static -no-pie -Wl,--export-dynamic readelf -W --dyn-syms $t/exe1 | grep -w foo $QEMU $t/exe1 | grep 'Hello world' echo '{ foo; };' > $t/dyn -$CC -B. -o $t/exe2 $t/a.o -static -Wl,--dynamic-list=$t/dyn +$CC -B. -o $t/exe2 $t/a.o -static -no-pie -Wl,--dynamic-list=$t/dyn readelf -W --dyn-syms $t/exe2 | grep -w foo $QEMU $t/exe2 | grep 'Hello world' -$CC -B. -o $t/exe3 $t/a.o -static +$CC -B. -o $t/exe3 $t/a.o -static -no-pie readelf -WS $t/exe3 | not grep -F .dynamic