[llvm] 4aae538 - [llvm][CMake] Respect LIBCXX_HARDENING_MODE on command-line (#68541)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 20 23:13:37 PDT 2023
Author: Will Hawkins
Date: 2023-10-20T23:13:33-07:00
New Revision: 4aae5387a874a55ee491f5dc23ce0506c5cdc678
URL: https://github.com/llvm/llvm-project/commit/4aae5387a874a55ee491f5dc23ce0506c5cdc678
DIFF: https://github.com/llvm/llvm-project/commit/4aae5387a874a55ee491f5dc23ce0506c5cdc678.diff
LOG: [llvm][CMake] Respect LIBCXX_HARDENING_MODE on command-line (#68541)
When the user specifies `LIBCXX_HARDENING_MODE` on the command line in a
bootstrapping build, it should override the setting implied by
`LLVM_ENABLE_ASSERTIONS`.
Added:
Modified:
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index fc5ddca1e5126a8..ca7cedd6e4afff4 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -111,8 +111,13 @@ if( LLVM_ENABLE_ASSERTIONS )
endif()
# Enable assertions in libstdc++.
add_compile_definitions(_GLIBCXX_ASSERTIONS)
- # Enable the hardened mode in libc++.
- add_compile_definitions(_LIBCPP_ENABLE_HARDENED_MODE)
+ # Cautiously enable the safe hardened mode in libc++.
+ if((DEFINED LIBCXX_HARDENING_MODE) AND
+ (NOT LIBCXX_HARDENING_MODE STREQUAL "safe"))
+ message(WARNING "LLVM_ENABLE_ASSERTIONS implies LIBCXX_HARDENING_MODE \"safe\" but is overriden from command line with value \"${LIBCXX_HARDENING_MODE}\".")
+ else()
+ set(LIBCXX_HARDENING_MODE "safe")
+ endif()
endif()
if(LLVM_ENABLE_EXPENSIVE_CHECKS)
More information about the llvm-commits
mailing list