Skip to content

Commit

Permalink
Rollup merge of #63621 - jgalenson:dndebug, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Centril authored Aug 17, 2019
2 parents 2028905 + 1916036 commit 84b7c28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 84b7c28

Please sign in to comment.