mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
build: enable libc++ hardening
When compiling with libc++ in debug mode, then enable full libc++ hardening. Inspired by https://github.com/bitcoin/bitcoin/issues/31272#issuecomment-2518700939
This commit is contained in:
parent
c5e44a0435
commit
e83494d75f
2 changed files with 8 additions and 0 deletions
|
@ -566,6 +566,12 @@ else()
|
|||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
try_append_linker_flag("-Wl,-fixup_chains" TARGET core_interface)
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBCPP)
|
||||
# https://libcxx.llvm.org/Hardening.html
|
||||
target_compile_definitions(core_interface INTERFACE
|
||||
$<IF:$<CONFIG:Debug>,_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG,>)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(REDUCE_EXPORTS)
|
||||
|
|
|
@ -12,6 +12,8 @@ check_include_file_cxx(sys/resources.h HAVE_SYS_RESOURCES_H)
|
|||
check_include_file_cxx(sys/vmmeter.h HAVE_SYS_VMMETER_H)
|
||||
check_include_file_cxx(vm/vm_param.h HAVE_VM_VM_PARAM_H)
|
||||
|
||||
check_cxx_symbol_exists(_LIBCPP_VERSION "version" HAVE_LIBCPP)
|
||||
|
||||
check_cxx_symbol_exists(O_CLOEXEC "fcntl.h" HAVE_O_CLOEXEC)
|
||||
check_cxx_symbol_exists(fdatasync "unistd.h" HAVE_FDATASYNC)
|
||||
check_cxx_symbol_exists(fork "unistd.h" HAVE_DECL_FORK)
|
||||
|
|
Loading…
Add table
Reference in a new issue