mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Migrate static-pie
to rmake
This commit is contained in:
parent
e16f492e42
commit
f90d4e4371
@ -176,7 +176,6 @@ run-make/split-debuginfo/Makefile
|
||||
run-make/stable-symbol-names/Makefile
|
||||
run-make/static-dylib-by-default/Makefile
|
||||
run-make/static-extern-type/Makefile
|
||||
run-make/static-pie/Makefile
|
||||
run-make/staticlib-blank-lib/Makefile
|
||||
run-make/staticlib-dylib-linkage/Makefile
|
||||
run-make/std-core-cycle/Makefile
|
||||
|
@ -1,18 +0,0 @@
|
||||
include ../tools.mk
|
||||
|
||||
# only-x86_64
|
||||
# only-linux
|
||||
# ignore-32bit
|
||||
|
||||
# How to manually run this
|
||||
# $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] tests/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
|
46
tests/run-make/static-pie/rmake.rs
Normal file
46
tests/run-make/static-pie/rmake.rs
Normal file
@ -0,0 +1,46 @@
|
||||
// How to manually run this
|
||||
// $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] tests/run-make/static-pie
|
||||
|
||||
//@ only-x86_64
|
||||
//@ only-linux
|
||||
//@ ignore-32bit
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
use run_make_support::llvm_readobj;
|
||||
use run_make_support::rustc;
|
||||
use run_make_support::{cmd, run_with_args, target};
|
||||
|
||||
fn ok_compiler_version(compiler: &str) -> bool {
|
||||
let check_file = format!("check_{compiler}_version.sh");
|
||||
|
||||
Command::new(check_file).status().is_ok_and(|status| status.success())
|
||||
}
|
||||
|
||||
fn test(compiler: &str) {
|
||||
if !ok_compiler_version(compiler) {
|
||||
return;
|
||||
}
|
||||
|
||||
rustc()
|
||||
.input("test-aslr.rs")
|
||||
.target(&target())
|
||||
.linker(compiler)
|
||||
.arg("-Clinker-flavor=gcc")
|
||||
.arg("-Ctarget-feature=+crt-static")
|
||||
.run();
|
||||
|
||||
llvm_readobj()
|
||||
.symbols()
|
||||
.input("test-aslr")
|
||||
.run()
|
||||
.assert_stdout_not_contains("INTERP")
|
||||
.assert_stdout_contains("DYNAMIC");
|
||||
|
||||
run_with_args("test-aslr", &["--test-aslr"]);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
test("clang");
|
||||
test("gcc");
|
||||
}
|
Loading…
Reference in New Issue
Block a user