about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2024-07-13 00:24:35 -0400
committerGitHub <noreply@github.com>2024-07-13 00:24:35 -0400
commitcb1ccc184265f0988cf22fc8329b97a3a32ba8f6 (patch)
treeccbabb496be92b2f971abea4787d1adddf42f979 /src/bootstrap
parent03c2100dede5d8779a032cf1fc1c28201c37048a (diff)
parent8dfd3a455dc7d309f0c82dcb2e2f41da14f6c4af (diff)
downloadrust-cb1ccc184265f0988cf22fc8329b97a3a32ba8f6.tar.gz
rust-cb1ccc184265f0988cf22fc8329b97a3a32ba8f6.zip
Rollup merge of #127654 - nikic:llvm-ndebug-fix, r=cuviper
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.

Split the LLVM_NDEBUG environment variable into two, so that assertions and debuginfo are controlled independently.

After this change, `LLVMRustDIBuilderInsertDeclareAtEnd` triggers an assertion failure on LLVM 19 due to an incorrect cast. Fix it by removing the unused return value entirely.

r? `@cuviper`
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs4
1 files changed, 2 insertions, 2 deletions
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");
     }
 }