-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add thread and address sanitisation
Signed-off-by: Ole Petter <[email protected]>
- Loading branch information
1 parent
9621c1f
commit c0ecdfd
Showing
6 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,5 +55,6 @@ config.h | |
**/CMakeFiles/ | ||
/_deps/ | ||
*.cmake | ||
!/cmake/*.cmake | ||
/Testing | ||
/install_manifest*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include(cmake/helper.cmake) | ||
|
||
if (CMAKE_BUILD_TYPE STREQUAL "ASan") | ||
sanitizer_add_compiler_flags(ASAN | ||
"-fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope" | ||
"-fsanitize=address") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
|
||
function (sanitizer_add_compiler_flags CONFIG SANITIZER_BUILD_FLAGS SANITIZER_SHARED_LINKER_FLAGS) | ||
|
||
message (STATUS "Adding the compiler flags flags: ${SANITIZER_BUILD_FLAGS}") | ||
message (STATUS "Adding the linked flags: ${SANITIZER_SHARED_LINKER_FLAGS}") | ||
|
||
set(CMAKE_C_FLAGS_${CONFIG} | ||
"${CMAKE_C_FLAGS_DEBUG} ${SANITIZER_BUILD_FLAGS}" CACHE STRING | ||
"Flags used by the C compiler for ${CONFIG} build type or configuration." FORCE) | ||
|
||
set(CMAKE_CXX_FLAGS_${CONFIG} | ||
"${CMAKE_CXX_FLAGS_DEBUG} ${SANITIZER_BUILD_FLAGS}" CACHE STRING | ||
"Flags used by the C++ compiler for ${CONFIG} build type or configuration." FORCE) | ||
|
||
set(CMAKE_EXE_LINKER_FLAGS_${CONFIG} | ||
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${SANITIZER_BUILD_FLAGS}" CACHE STRING | ||
"Linker flags to be used to create executables for ${CONFIG} build type." FORCE) | ||
|
||
set(CMAKE_SHARED_LINKER_FLAGS_${CONFIG} | ||
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${SANITIZER_SHARED_LINKER_FLAGS}" CACHE STRING | ||
"Linker lags to be used to create shared libraries for ${CONFIG} build type." FORCE) | ||
|
||
endfunction () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include(cmake/helper.cmake) | ||
|
||
if (CMAKE_BUILD_TYPE STREQUAL "ThreadSan") | ||
sanitizer_add_compiler_flags(THREADSAN | ||
"-fsanitize=thread -fPIE -fpie" | ||
"-fsanitize=thread") | ||
endif() |