mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
CMake: Add proper sanitizer options for Swift files
Apparently UBSAN + Swift doesn't work on Linux :<
This commit is contained in:
parent
07d387af96
commit
7afe183172
Notes:
github-actions[bot]
2024-07-31 00:39:08 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/7afe183172f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/821
2 changed files with 11 additions and 9 deletions
|
@ -43,13 +43,10 @@ endif()
|
|||
if (ENABLE_MEMORY_SANITIZER)
|
||||
add_cxx_compile_options(-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer)
|
||||
add_cxx_link_options(-fsanitize=memory -fsanitize-memory-track-origins)
|
||||
add_swift_compile_options(-sanitize=memory)
|
||||
add_swift_link_options(-sanitize=memory)
|
||||
endif()
|
||||
|
||||
if (ENABLE_UNDEFINED_SANITIZER)
|
||||
if (ENABLE_UNDEFINED_SANITIZER AND (APPLE OR NOT ENABLE_SWIFT))
|
||||
add_cxx_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
|
||||
add_swift_compile_options(-sanitize=address)
|
||||
if (UNDEFINED_BEHAVIOR_IS_FATAL)
|
||||
add_cxx_compile_options(-fno-sanitize-recover=undefined)
|
||||
endif()
|
||||
|
@ -57,7 +54,8 @@ if (ENABLE_UNDEFINED_SANITIZER)
|
|||
add_cxx_compile_options(-fno-sanitize=function)
|
||||
endif()
|
||||
add_cxx_link_options(-fsanitize=undefined)
|
||||
add_swift_link_options(-sanitize=address)
|
||||
add_swift_compile_options(-sanitize=undefined)
|
||||
add_swift_link_options(-sanitize=undefined)
|
||||
endif()
|
||||
|
||||
if (HAIKU)
|
||||
|
|
|
@ -94,15 +94,17 @@ endif()
|
|||
|
||||
if (ENABLE_ADDRESS_SANITIZER)
|
||||
add_cxx_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=address")
|
||||
add_cxx_link_options(-fsanitize=address)
|
||||
add_swift_compile_options(-sanitize=address)
|
||||
add_swift_link_options(-sanitize=address)
|
||||
endif()
|
||||
|
||||
if (ENABLE_MEMORY_SANITIZER)
|
||||
add_cxx_compile_options(-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer)
|
||||
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=memory -fsanitize-memory-track-origins")
|
||||
add_cxx_link_options(-fsanitize=memory -fsanitize-memory-track-origins)
|
||||
endif()
|
||||
|
||||
if (ENABLE_UNDEFINED_SANITIZER)
|
||||
if (ENABLE_UNDEFINED_SANITIZER AND (APPLE OR NOT ENABLE_SWIFT))
|
||||
add_cxx_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
|
||||
if (UNDEFINED_BEHAVIOR_IS_FATAL)
|
||||
add_cxx_compile_options(-fno-sanitize-recover=undefined)
|
||||
|
@ -110,7 +112,9 @@ if (ENABLE_UNDEFINED_SANITIZER)
|
|||
if (APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang$" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "17")
|
||||
add_cxx_compile_options(-fno-sanitize=function)
|
||||
endif()
|
||||
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=undefined")
|
||||
add_cxx_link_options(-fsanitize=undefined)
|
||||
add_swift_compile_options(-sanitize=undefined)
|
||||
add_swift_link_options(-sanitize=undefined)
|
||||
endif()
|
||||
|
||||
if (ENABLE_COMPILETIME_FORMAT_CHECK)
|
||||
|
|
Loading…
Reference in a new issue