about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-17 11:13:47 +0200
committerGitHub <noreply@github.com>2019-08-17 11:13:47 +0200
commit6bce50f390bbdfca66966c26adec42b927670f4f (patch)
treedfcd4fc58e4f37e2ca05d7f8a877787fc574a8f5 /src
parenta053baefebb56b59bd6c40a3ca0726efc18f4209 (diff)
parent191603653b90e25d8e0e67f125aec523412b51f9 (diff)
downloadrust-6bce50f390bbdfca66966c26adec42b927670f4f.tar.gz
rust-6bce50f390bbdfca66966c26adec42b927670f4f.zip
Rollup merge of #63621 - jgalenson:dndebug, r=alexcrichton
Modify librustc_llvm to pass -DNDEBUG while compiling.

Currently, librustc_llvm builds are not reproducible because the LLVM files it compiles use the debug version of llvm_unreachable, which uses __FILE__.  To fix this, we propagate NDEBUG from bootstrap if applicable and use it when compiling librustc_llvm.

r? @alexcrichton
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/compile.rs3
-rw-r--r--src/librustc_llvm/build.rs4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 12eb2c882ad..96987d08159 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -790,6 +790,9 @@ pub fn build_codegen_backend(builder: &Builder<'_>,
             if builder.config.llvm_use_libcxx {
                 cargo.env("LLVM_USE_LIBCXX", "1");
             }
+            if builder.config.llvm_optimize && !builder.config.llvm_release_debuginfo {
+                cargo.env("LLVM_NDEBUG", "1");
+            }
         }
         _ => panic!("unknown backend: {}", backend),
     }
diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs
index 8391822bb75..40ddd651642 100644
--- a/src/librustc_llvm/build.rs
+++ b/src/librustc_llvm/build.rs
@@ -151,6 +151,10 @@ fn main() {
         cfg.define("LLVM_RUSTLLVM", None);
     }
 
+    if env::var_os("LLVM_NDEBUG").is_some() {
+        cfg.define("NDEBUG", None);
+    }
+
     build_helper::rerun_if_changed_anything_in_dir(Path::new("../rustllvm"));
     cfg.file("../rustllvm/PassWrapper.cpp")
        .file("../rustllvm/RustWrapper.cpp")