blob: f9d7fd98789e62e0be6491f5bd32c9d45acec3e8 [file] [log] [blame] [edit]
// Identical to sanitizer-dylib-link, but with a cdylib.
// 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 cdylib
// 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("cdylib").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");
}