1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-26 21:20:46 +03:00
mold/test/elf/execstack.sh
2022-10-06 12:07:31 +08:00

16 lines
396 B
Bash
Executable File

#!/bin/bash
. $(dirname $0)/common.inc
cat <<EOF | $CC -c -xc -o $t/a.o -
int main() {}
EOF
$CC -B. -o $t/exe $t/a.o -Wl,-z,execstack
readelf --segments -W $t/exe | grep -q 'GNU_STACK.* RWE '
$CC -B. -o $t/exe $t/a.o -Wl,-z,execstack -Wl,-z,noexecstack
readelf --segments -W $t/exe | grep -q 'GNU_STACK.* RW '
$CC -B. -o $t/exe $t/a.o
readelf --segments -W $t/exe | grep -q 'GNU_STACK.* RW '