summaryrefslogtreecommitdiffstats
path: root/src/test/run-make/static-pie
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/test/run-make/static-pie
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-make/static-pie')
-rw-r--r--src/test/run-make/static-pie/Makefile18
-rwxr-xr-xsrc/test/run-make/static-pie/check_clang_version.sh20
-rwxr-xr-xsrc/test/run-make/static-pie/check_gcc_version.sh20
-rw-r--r--src/test/run-make/static-pie/test-aslr.rs43
4 files changed, 0 insertions, 101 deletions
diff --git a/src/test/run-make/static-pie/Makefile b/src/test/run-make/static-pie/Makefile
deleted file mode 100644
index e71770636..000000000
--- a/src/test/run-make/static-pie/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-include ../../run-make-fulldeps/tools.mk
-
-# only-x86_64
-# only-linux
-# ignore-gnux32
-
-# How to manually run this
-# $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] src/test/run-make/static-pie
-
-all: test-clang test-gcc
-
-test-%:
- if ./check_$*_version.sh; then\
- ${RUSTC} -Clinker=$* -Clinker-flavor=gcc --target ${TARGET} -C target-feature=+crt-static test-aslr.rs; \
- ! readelf -l $(call RUN_BINFILE,test-aslr) | $(CGREP) INTERP; \
- readelf -l $(call RUN_BINFILE,test-aslr) | $(CGREP) DYNAMIC; \
- $(call RUN,test-aslr) --test-aslr; \
- fi
diff --git a/src/test/run-make/static-pie/check_clang_version.sh b/src/test/run-make/static-pie/check_clang_version.sh
deleted file mode 100755
index b8e97c3da..000000000
--- a/src/test/run-make/static-pie/check_clang_version.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-set -euo pipefail
-
-if command -v clang > /dev/null
-then
- CLANG_VERSION=$(echo __clang_major__ | clang -E -x c - | grep -v -e '^#' )
- echo "clang version $CLANG_VERSION detected"
- if (( $CLANG_VERSION >= 9 ))
- then
- echo "clang supports -static-pie"
- exit 0
- else
- echo "clang too old to support -static-pie, skipping test"
- exit 1
- fi
-else
- echo "No clang version detected"
- exit 2
-fi
diff --git a/src/test/run-make/static-pie/check_gcc_version.sh b/src/test/run-make/static-pie/check_gcc_version.sh
deleted file mode 100755
index d07e1d151..000000000
--- a/src/test/run-make/static-pie/check_gcc_version.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-set -euo pipefail
-
-if command -v gcc > /dev/null
-then
- GCC_VERSION=$(echo __GNUC__ | gcc -E -x c - | grep -v -e '^#' )
- echo "gcc version $GCC_VERSION detected"
- if (( $GCC_VERSION >= 8 ))
- then
- echo "gcc supports -static-pie"
- exit 0
- else
- echo "gcc too old to support -static-pie, skipping test"
- exit 1
- fi
-else
- echo "No gcc version detected"
- exit 2
-fi
diff --git a/src/test/run-make/static-pie/test-aslr.rs b/src/test/run-make/static-pie/test-aslr.rs
deleted file mode 100644
index 96b17af46..000000000
--- a/src/test/run-make/static-pie/test-aslr.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-const NUM_RUNS: usize = 10;
-
-fn run_self(exe: &str) -> usize {
- use std::process::Command;
- let mut set = std::collections::HashSet::new();
-
- let mut cmd = Command::new(exe);
- cmd.arg("--report");
- (0..NUM_RUNS).for_each(|_| {
- set.insert(cmd.output().expect("failed to execute process").stdout);
- });
- set.len()
-}
-
-fn main() {
- let mut args = std::env::args();
- let arg0 = args.next().unwrap();
- match args.next() {
- Some(s) if s.eq("--report") => {
- println!("main = {:#?}", &main as *const _);
- }
- Some(s) if s.eq("--test-no-aslr") => {
- let cnt = run_self(&arg0);
- if cnt != 1 {
- eprintln!("FAIL: {} most likely ASLR", arg0);
- std::process::exit(1);
- }
- println!("PASS: {} does no ASLR", arg0);
- }
- Some(s) if s.eq("--test-aslr") => {
- let cnt = run_self(&arg0);
- if cnt == 1 {
- eprintln!("FAIL: {} most likely no ASLR", arg0);
- std::process::exit(1);
- }
- println!("PASS: {} does ASLR", arg0);
- }
- Some(_) | None => {
- println!("Usage: {} --test-no-aslr | --test-aslr", arg0);
- std::process::exit(1);
- }
- }
-}