aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2020-12-06 17:52:13 +0100
committerShauren <shauren.trinity@gmail.com>2022-01-04 20:44:25 +0100
commit89e183704cab51b245537f3f2f8c6ceb9339740b (patch)
tree0e106bd40bafd90caee488a80591efe393f50dee /cmake
parent1d0ca1106f97c8631376a5ab0a7ab9e3d4383a16 (diff)
Improve multithreading of mmaps_generator (#25625)
* Build/Misc: Add a few *San CMake flags Add the following flags for the related tools: - MSAN for Memory Sanitizer - UBSAN for Undefined Behavior Sanitizer - TSAN for Thread Sanitizer * Remove unused parameter * Fix UBSan reported issue * Disable G3D buffer pools when using Thread Sanitizer as it has its custom locking mechanisms * Code cleanup * Move threads from maps to tiles * Move tile building logic to TileBuilder class * Fix memory leak in TileBuilder * Fix build * Store TileBuilder as raw pointer for now, it will be changed later on to use modern C++ constructs * Fix crash on shutdown * Revert pvs-studio change * Fix generating 1 single tile not closing the program (cherry picked from commit a4e93d779c9638bc0a61cb4405ef28cb935d1065)
Diffstat (limited to 'cmake')
-rw-r--r--cmake/compiler/clang/settings.cmake48
-rw-r--r--cmake/showoptions.cmake23
2 files changed, 69 insertions, 2 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake
index cc756a92131..87f017d639b 100644
--- a/cmake/compiler/clang/settings.cmake
+++ b/cmake/compiler/clang/settings.cmake
@@ -51,7 +51,53 @@ if(ASAN)
-fsanitize-recover=address
-fsanitize-address-use-after-scope)
- message(STATUS "Clang: Enabled Address Sanitizer")
+ message(STATUS "Clang: Enabled Address Sanitizer ASan")
+endif()
+
+if(MSAN)
+ target_compile_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=memory
+ -fsanitize-memory-track-origins
+ -mllvm
+ -msan-keep-going=1)
+
+ target_link_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=memory
+ -fsanitize-memory-track-origins)
+
+ message(STATUS "Clang: Enabled Memory Sanitizer MSan")
+endif()
+
+if(UBSAN)
+ target_compile_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=undefined)
+
+ target_link_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=undefined)
+
+ message(STATUS "Clang: Enabled Undefined Behavior Sanitizer UBSan")
+endif()
+
+if(TSAN)
+ target_compile_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=thread)
+
+ target_link_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-omit-frame-pointer
+ -fsanitize=thread)
+
+ message(STATUS "Clang: Enabled Thread Sanitizer TSan")
endif()
# -Wno-narrowing needed to suppress a warning in g3d
diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake
index c4e7ebff950..51f3414cf76 100644
--- a/cmake/showoptions.cmake
+++ b/cmake/showoptions.cmake
@@ -111,7 +111,28 @@ if ( ASAN )
add_definitions(-DASAN)
endif()
-if ( PERFORMANCE_PROFILING )
+if(MSAN)
+ message("")
+ message(" *** MSAN - WARNING!")
+ message(" *** Please note that this is for DEBUGGING WITH MEMORY SANITIZER only!")
+ add_definitions(-DMSAN)
+endif()
+
+if(UBSAN)
+ message("")
+ message(" *** UBSAN - WARNING!")
+ message(" *** Please note that this is for DEBUGGING WITH UNDEFINED BEHAVIOR SANITIZER only!")
+ add_definitions(-DUBSAN)
+endif()
+
+if(TSAN)
+ message("")
+ message(" *** TSAN - WARNING!")
+ message(" *** Please note that this is for DEBUGGING WITH THREAD SANITIZER only!")
+ add_definitions(-DTSAN -DNO_BUFFERPOOL)
+endif()
+
+if(PERFORMANCE_PROFILING)
message("")
message(" *** PERFORMANCE_PROFILING - WARNING!")
message(" *** Please note that this is for PERFORMANCE PROFILING only! Do NOT report any issue when enabling this configuration!")