diff options
| author | Nikita Popov <npopov@redhat.com> | 2024-07-12 14:48:42 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2024-07-12 22:13:56 +0200 |
| commit | 776b0adaafa2198caa0ef6485e3e78a43620a58b (patch) | |
| tree | e9cb4d09e06255f9274479523b29f56fd3513f3b | |
| parent | 0fdfb61795b40037955154638fe35f20b16c8e55 (diff) | |
Fix incorrect NDEBUG handling in LLVM bindings
We currently compile our LLVM bindings using `-DNDEBUG` if debuginfo for LLVM is disabled. However, `NDEBUG` doesn't have any relation to debuginfo, it controls whether assertions are enabled. Rename the environment variable to `LLVM_ASSERTIONS` and drive it using the `llvm_assertions` option. Also drop the explicit `debug(false)` call, as cc already sets this up using the cargo `DEBUG` environment variable.
| -rw-r--r-- | compiler/rustc_llvm/build.rs | 3 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index 3aa852c8304..4c1f78e6bee 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -197,9 +197,8 @@ fn main() { cfg.define("LLVM_RUSTLLVM", None); } - if tracked_env_var_os("LLVM_NDEBUG").is_some() { + if tracked_env_var_os("LLVM_ASSERTIONS").is_none() { cfg.define("NDEBUG", None); - cfg.debug(false); } rerun_if_changed_anything_in_dir(Path::new("llvm-wrapper")); diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 11a7a404535..714a1004281 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1213,8 +1213,8 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect 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"); + if builder.config.llvm_assertions { + cargo.env("LLVM_ASSERTIONS", "1"); } } |
