diff options
| author | Ximin Luo <infinity0@pwned.gg> | 2019-09-05 00:14:09 -0700 |
|---|---|---|
| committer | Ximin Luo <infinity0@pwned.gg> | 2019-09-05 00:14:09 -0700 |
| commit | 485697bf42cc6a03712e82e69c8f2357a2576454 (patch) | |
| tree | 40796aaa3c4fd4e4416ba2a23370e68a0b2673c7 | |
| parent | a24f636e60a5da57ab641d800ac5952bbde98b65 (diff) | |
Better way of conditioning the sanitizer builds
Previously the build would take the presence of the LLVM_CONFIG envvar to mean that the sanitizers should be built, but this is a common envvar that could be set for reasons unrelated to the rustc sanitizers. This commit adds a new envvar RUSTC_BUILD_SANITIZERS and uses it instead.
| -rw-r--r-- | src/bootstrap/compile.rs | 1 | ||||
| -rw-r--r-- | src/librustc_asan/build.rs | 3 | ||||
| -rw-r--r-- | src/librustc_lsan/build.rs | 3 | ||||
| -rw-r--r-- | src/librustc_msan/build.rs | 3 | ||||
| -rw-r--r-- | src/librustc_tsan/build.rs | 3 |
5 files changed, 13 insertions, 0 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 9d57a4f00d7..9a964457ef2 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -212,6 +212,7 @@ pub fn std_cargo(builder: &Builder<'_>, emscripten: false, }); cargo.env("LLVM_CONFIG", llvm_config); + cargo.env("RUSTC_BUILD_SANITIZERS", "1"); } cargo.arg("--features").arg(features) diff --git a/src/librustc_asan/build.rs b/src/librustc_asan/build.rs index a2b4b090efb..cc856ba68fb 100644 --- a/src/librustc_asan/build.rs +++ b/src/librustc_asan/build.rs @@ -4,6 +4,9 @@ use build_helper::sanitizer_lib_boilerplate; use cmake::Config; fn main() { + if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) { + return; + } if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { build_helper::restore_library_path(); diff --git a/src/librustc_lsan/build.rs b/src/librustc_lsan/build.rs index b8c7b7c2d55..d5f3e37dea5 100644 --- a/src/librustc_lsan/build.rs +++ b/src/librustc_lsan/build.rs @@ -4,6 +4,9 @@ use build_helper::sanitizer_lib_boilerplate; use cmake::Config; fn main() { + if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) { + return; + } if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { build_helper::restore_library_path(); diff --git a/src/librustc_msan/build.rs b/src/librustc_msan/build.rs index 1c66b0a9cd3..de1676f489a 100644 --- a/src/librustc_msan/build.rs +++ b/src/librustc_msan/build.rs @@ -4,6 +4,9 @@ use build_helper::sanitizer_lib_boilerplate; use cmake::Config; fn main() { + if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) { + return; + } if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { build_helper::restore_library_path(); diff --git a/src/librustc_tsan/build.rs b/src/librustc_tsan/build.rs index ed9c37087c7..6df96912574 100644 --- a/src/librustc_tsan/build.rs +++ b/src/librustc_tsan/build.rs @@ -4,6 +4,9 @@ use build_helper::sanitizer_lib_boilerplate; use cmake::Config; fn main() { + if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) { + return; + } if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { build_helper::restore_library_path(); |
