rewrite sanitizer-dylib-link to rmake

This commit is contained in:
Oneirical 2024-07-22 16:30:32 -04:00
parent 952d916840
commit fe3fbf0ab4
3 changed files with 16 additions and 18 deletions

View File

@ -70,8 +70,6 @@ run-make/reproducible-build-2/Makefile
run-make/reproducible-build/Makefile
run-make/rlib-format-packed-bundled-libs-2/Makefile
run-make/rlib-format-packed-bundled-libs/Makefile
run-make/sanitizer-cdylib-link/Makefile
run-make/sanitizer-dylib-link/Makefile
run-make/sanitizer-staticlib-link/Makefile
run-make/share-generics-dylib/Makefile
run-make/simd-ffi/Makefile

View File

@ -1,16 +0,0 @@
# needs-sanitizer-support
# needs-sanitizer-address
include ../tools.mk
LOG := $(TMPDIR)/log.txt
# This test builds a shared object, then an executable that links it as a native
# rust library (contrast to an rlib). The shared library and executable both
# are compiled with address sanitizer, and we assert that a fault in the dylib
# is correctly detected.
all:
$(RUSTC) -g -Z sanitizer=address --crate-type dylib --target $(TARGET) library.rs
$(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) program.rs
LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow

View File

@ -0,0 +1,16 @@
// This test builds a shared object, then an executable that links it as a native
// rust library (contrast to an rlib). The shared library and executable both
// are compiled with address sanitizer, and we assert that a fault in the dylib
// is correctly detected.
// See https://github.com/rust-lang/rust/pull/38699
//@ needs-sanitizer-support
//@ needs-sanitizer-address
use run_make_support::{run_fail, rustc};
fn main() {
rustc().arg("-g").arg("-Zsanitizer=address").crate_type("dylib").input("library.rs").run();
rustc().arg("-g").arg("-Zsanitizer=address").crate_type("bin").input("program.rs").run();
run_fail("program").assert_stderr_contains("stack-buffer-overflow");
}