rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.42k stars 12.73k forks source link

Leak sanitizer does not work on aarch64 macOS #98473

Open BlackHoleFox opened 2 years ago

BlackHoleFox commented 2 years ago

I tried this code:

fn main() {
   println!("leak time");

   <snip some Objective-C code that has leaks>
}
[package]
name = "example"
version = "0.1.0"
edition = "2021"

[dependencies]
mac-notification-sys = "0.5.2"
export RUSTFLAGS="-Z sanitizer=leak";
cargo +nightly run

I expected to see this happen: The binary would be built and run with the leak sanitizer enabled.

Instead, this happened: rustc writes an unsupported error and exits. The sanitizer docs state aarch64-apple-darwin to be a supported target, which conflicts with the actual behavior. I don't know if the documentation is incorrect or if there's a compiler bug somewhere.

Meta

rustc --version --verbose:

rustc 1.63.0-nightly (43347397f 2022-06-23)
binary: rustc
commit-hash: 43347397f7c5ca9a670a3bb3890c7187e24a52ab
commit-date: 2022-06-23
host: aarch64-apple-darwin
release: 1.63.0-nightly
LLVM version: 14.0.5
Backtrace

``` error: failed to run `rustc` to learn about target-specific information Caused by: process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Z sanitizer=leak --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1) --- stdout ___ lib___.rlib lib___.dylib lib___.dylib lib___.a lib___.dylib /Users/fox/.rustup/toolchains/nightly-aarch64-apple-darwin debug_assertions panic="unwind" proc_macro sanitize="leak" target_abi="" target_arch="aarch64" target_endian="little" target_env="" target_family="unix" target_feature="aes" target_feature="crc" target_feature="dit" target_feature="dotprod" target_feature="dpb" target_feature="dpb2" target_feature="fcma" target_feature="fhm" target_feature="flagm" target_feature="fp16" target_feature="frintts" target_feature="jsconv" target_feature="llvm14-builtins-abi" target_feature="lor" target_feature="lse" target_feature="neon" target_feature="paca" target_feature="pacg" target_feature="pan" target_feature="pmuv3" target_feature="ras" target_feature="rcpc" target_feature="rcpc2" target_feature="rdm" target_feature="sb" target_feature="sha2" target_feature="sha3" target_feature="ssbs" target_feature="v8.1a" target_feature="v8.2a" target_feature="v8.3a" target_feature="v8.4a" target_feature="vh" target_has_atomic="128" target_has_atomic="16" target_has_atomic="32" target_has_atomic="64" target_has_atomic="8" target_has_atomic="ptr" target_has_atomic_equal_alignment="128" target_has_atomic_equal_alignment="16" target_has_atomic_equal_alignment="32" target_has_atomic_equal_alignment="64" target_has_atomic_equal_alignment="8" target_has_atomic_equal_alignment="ptr" target_has_atomic_load_store="128" target_has_atomic_load_store="16" target_has_atomic_load_store="32" target_has_atomic_load_store="64" target_has_atomic_load_store="8" target_has_atomic_load_store="ptr" target_os="macos" target_pointer_width="64" target_thread_local target_vendor="apple" unix --- stderr error: leak sanitizer is not supported for this target error: aborting due to previous error ```

BlackHoleFox commented 2 years ago

@rustbot label +O-macos

csmoe commented 2 years ago

https://github.com/rust-lang/rust/issues/88132 the doc should be fixed as leak isn't supported yet.

ehuss commented 2 weeks ago

Doc update is at #132097.