File tree Expand file tree Collapse file tree 3 files changed +49
-8
lines changed
src/test/run-make/static-pie Expand file tree Collapse file tree 3 files changed +49
-8
lines changed Original file line number Diff line number Diff line change 77# How to manually run this
88# $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] src/test/run-make/static-pie
99
10- all :
11- $(RUSTC ) --target $(TARGET ) -C target-feature=+crt-static test-aslr.rs
12- # Check that no dynamic interpreter is set
13- ! readelf -l $(call RUN_BINFILE,test-aslr) | $(CGREP ) INTERP
14- # Check that we have a dynamic executable
15- readelf -l $(call RUN_BINFILE,test-aslr) | $(CGREP ) DYNAMIC
16- # Check for address space layout randomization
17- $(call RUN,test-aslr) --test-aslr
10+ all : test-clang test-gcc
11+
12+ test-% :
13+ if ./check_$* _version.sh; then\
14+ ${RUSTC} -Clinker=$* -Clinker-flavor=gcc --target ${TARGET} -C target-feature=+crt-static test-aslr.rs; \
15+ ! readelf -l $(call RUN_BINFILE,test-aslr) | $(CGREP ) INTERP; \
16+ readelf -l $(call RUN_BINFILE,test-aslr) | $(CGREP ) DYNAMIC; \
17+ $(call RUN,test-aslr) --test-aslr; \
18+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ if command -v clang > /dev/null
6+ then
7+ CLANG_VERSION=$( echo __clang_major__ | clang -E -x c - | grep -v -e ' ^#' )
8+ echo " clang version $CLANG_VERSION detected"
9+ if (( $CLANG_VERSION >= 9 ))
10+ then
11+ echo " clang supports -static-pie"
12+ exit 0
13+ else
14+ echo " clang too old to support -static-pie, skipping test"
15+ exit 1
16+ fi
17+ else
18+ echo " No clang version detected"
19+ exit 2
20+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -euo pipefail
4+
5+ if command -v gcc > /dev/null
6+ then
7+ GCC_VERSION=$( echo __GNUC__ | gcc -E -x c - | grep -v -e ' ^#' )
8+ echo " gcc version $GCC_VERSION detected"
9+ if (( $GCC_VERSION >= 8 ))
10+ then
11+ echo " gcc supports -static-pie"
12+ exit 0
13+ else
14+ echo " gcc too old to support -static-pie, skipping test"
15+ exit 1
16+ fi
17+ else
18+ echo " No gcc version detected"
19+ exit 2
20+ fi
You can’t perform that action at this time.
0 commit comments