Skip to content

Commit

Permalink
fix: resolve the conflics between ub minimal runtime and asan (#79)
Browse files Browse the repository at this point in the history
Signed-off-by: msclock <msclock@qq.com>
  • Loading branch information
msclock authored Apr 2, 2024
1 parent 74b1ffb commit 51cf964
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmake/build/Hardening.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Example:
include_guard(GLOBAL)

include(${CMAKE_CURRENT_LIST_DIR}/../Common.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/Sanitizer.cmake)

set(USE_HARDENING
ON
Expand Down Expand Up @@ -123,6 +124,16 @@ endif()

flags_to_list(hardening_links "${hardening_links}")

# Handle the conflics between hardening ubsan and asan
if(san_available_flags MATCHES "-fsanitize=address")
message(
WARNING "Try to disable usan minimal runtime due to conflict with asan")
list(REMOVE_ITEM hardening_flags "-fsanitize=undefined"
"-fsanitize-minimal-runtime" "-fno-sanitize-recover=undefined")
list(REMOVE_ITEM hardening_links "-fsanitize=undefined"
"-fsanitize-minimal-runtime" "-fno-sanitize-recover=undefined")
endif()

message(STATUS "Final Hardening flags: ${hardening_flags}")
message(STATUS "Final Hardening links: ${hardening_links}")

Expand Down
File renamed without changes.

0 comments on commit 51cf964

Please sign in to comment.