[llvm] Enable libc++ hardening mode for LLVM_ENABLE_ASSERTIONS (PR #130243)
Brian Cain via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 14 13:37:38 PST 2026
androm3da wrote:
@var-const after re-reading the commit history I think I am starting to understand where the skew/confusion comes from.
We intentionally have `LLVM_ENABLE_ASSERTIONS` imply `LIBCXX_HARDENING_MODE` here so that enabling assertions means that the libc++ built here gets the benefit of assertions like clang and the binutils would? While that makes some sense to me, it seems like it's at odds with the libstdc++ behavior here:
```
# Enable assertions in libstdc++.
add_compile_definitions(_GLIBCXX_ASSERTIONS)
```
Or -- maybe it's not at odds at all? I guess the right thing to do for this PR is to *not* replace the code relating to `LIBCXX_HARDENING_MODE` but instead *add* `_LIBCPP_HARDENING_MODE_*` definitions to correspond with the `_GLIBCXX_*` ones? So that both effects would happen: clang-built-with-LLVM_ENABLE_LIBCXX gets the hardened libc++ but then also libc++ builds get built with `LIBCXX_HARDENING_MODE`.
I'll whip up a change like that -- probably makes the most sense.
https://github.com/llvm/llvm-project/pull/130243
More information about the llvm-commits
mailing list