Migrate static-pie to rmake

This commit is contained in:
Jerry Wang 2024-06-19 18:58:59 -04:00
parent e16f492e42
commit f90d4e4371
No known key found for this signature in database
GPG Key ID: B9657729C5192EDC
3 changed files with 46 additions and 19 deletions

View File

@ -176,7 +176,6 @@ run-make/split-debuginfo/Makefile
run-make/stable-symbol-names/Makefile run-make/stable-symbol-names/Makefile
run-make/static-dylib-by-default/Makefile run-make/static-dylib-by-default/Makefile
run-make/static-extern-type/Makefile run-make/static-extern-type/Makefile
run-make/static-pie/Makefile
run-make/staticlib-blank-lib/Makefile run-make/staticlib-blank-lib/Makefile
run-make/staticlib-dylib-linkage/Makefile run-make/staticlib-dylib-linkage/Makefile
run-make/std-core-cycle/Makefile run-make/std-core-cycle/Makefile

View File

@ -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

View 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");
}