2019-10-22 00:00:00 +00:00
|
|
|
// Verifies that when compiling with -Zsanitizer=option,
|
|
|
|
// the `#[cfg(sanitize = "option")]` attribute is configured.
|
|
|
|
|
|
|
|
//@ check-pass
|
2023-09-08 00:00:00 +00:00
|
|
|
//@ revisions: address cfi kcfi leak memory thread
|
2023-09-21 00:00:00 +00:00
|
|
|
//@compile-flags: -Ctarget-feature=-crt-static
|
2023-09-08 00:00:00 +00:00
|
|
|
//@[address]needs-sanitizer-address
|
2019-10-22 00:00:00 +00:00
|
|
|
//@[address]compile-flags: -Zsanitizer=address --cfg address
|
2023-09-08 00:00:00 +00:00
|
|
|
//@[cfi]needs-sanitizer-cfi
|
2023-09-10 00:00:00 +00:00
|
|
|
//@[cfi]compile-flags: -Zsanitizer=cfi --cfg cfi
|
2023-09-21 00:00:00 +00:00
|
|
|
//@[cfi]compile-flags: -Clto -Ccodegen-units=1
|
2023-09-10 00:00:00 +00:00
|
|
|
//@[kcfi]needs-llvm-components: x86
|
|
|
|
//@[kcfi]compile-flags: -Zsanitizer=kcfi --cfg kcfi --target x86_64-unknown-none
|
2024-03-29 16:35:58 +00:00
|
|
|
//@[kcfi]compile-flags: -C panic=abort
|
2023-09-08 00:00:00 +00:00
|
|
|
//@[leak]needs-sanitizer-leak
|
2019-10-22 00:00:00 +00:00
|
|
|
//@[leak]compile-flags: -Zsanitizer=leak --cfg leak
|
2023-09-08 00:00:00 +00:00
|
|
|
//@[memory]needs-sanitizer-memory
|
2019-10-22 00:00:00 +00:00
|
|
|
//@[memory]compile-flags: -Zsanitizer=memory --cfg memory
|
2023-09-08 00:00:00 +00:00
|
|
|
//@[thread]needs-sanitizer-thread
|
2019-10-22 00:00:00 +00:00
|
|
|
//@[thread]compile-flags: -Zsanitizer=thread --cfg thread
|
|
|
|
|
2023-09-10 00:00:00 +00:00
|
|
|
#![feature(cfg_sanitize, no_core, lang_items)]
|
|
|
|
#![crate_type="lib"]
|
|
|
|
#![no_core]
|
|
|
|
|
|
|
|
#[lang="sized"]
|
|
|
|
trait Sized { }
|
|
|
|
#[lang="copy"]
|
|
|
|
trait Copy { }
|
2019-10-22 00:00:00 +00:00
|
|
|
|
|
|
|
#[cfg(all(sanitize = "address", address))]
|
|
|
|
fn main() {}
|
|
|
|
|
2022-12-13 06:42:44 +00:00
|
|
|
#[cfg(all(sanitize = "cfi", cfi))]
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
#[cfg(all(sanitize = "kcfi", kcfi))]
|
|
|
|
fn main() {}
|
|
|
|
|
2019-10-22 00:00:00 +00:00
|
|
|
#[cfg(all(sanitize = "leak", leak))]
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
#[cfg(all(sanitize = "memory", memory))]
|
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
#[cfg(all(sanitize = "thread", thread))]
|
|
|
|
fn main() {}
|
2023-09-10 00:00:00 +00:00
|
|
|
|
|
|
|
pub fn check() {
|
|
|
|
main();
|
|
|
|
}
|