rust-lang / wg-cargo-std-aware

Repo for working on "std aware cargo"
133 stars 8 forks source link

Deps: sanitizers #17

Open ehuss opened 4 years ago

ehuss commented 4 years ago

This issue is for working through the implementation issues for compiling the LLVM sanitizers.

Currently the standard library is built with several LLVM sanitizers on some platforms (asan tsan msan lsan). This requires access to the LLVM source, whose location is passed in with the LLVM_CONFIG environment variable.

For now, the plan is to not support the sanitizers when building the standard library from Cargo.

tmiasko commented 4 years ago

I think it might make sense to revisit implementation of sanitizers in rustc to make them more amenable for use with build-std. I would suggest distributing sanitizer runtimes as plain libraries along with rustc (rather than crate dependencies of std) and linking them in when enabled with -Z sanitizer=* and required for given crate type.

In that approach cargo plays no role in sanitizer support. There is no need, nor reason for rebuilding them as part of build-std. There is no dependency on LLVM source code outside rustc build process itself.

The implementation from https://github.com/rust-lang/rust/pull/31605 worked along those lines, and I can resurrect it back to life if this approach seems fine to you.