]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Try to fix gcc sanitizers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Nov 2019 12:19:32 +0000 (12:19 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Nov 2019 12:19:32 +0000 (12:19 +0000)
cmake/Sanitizer.cmake

index 34ef288a7207378749ef98f40043f99d63966554..73d72da8d25cf1941f2c13968ab3e865a2161a6a 100644 (file)
@@ -16,6 +16,8 @@ if (SANITIZE)
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SAN_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope")
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SAN_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope")
         if (COMPILER_GCC)
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libasan")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libasan")
             set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope")
             set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libasan")
         endif ()
@@ -27,6 +29,8 @@ if (SANITIZE)
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SAN_FLAGS} ${MSAN_FLAGS}")
 
         if (COMPILER_GCC)
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libmsan")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libmsan")
             set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory")
             set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libmsan")
         endif ()
@@ -34,10 +38,10 @@ if (SANITIZE)
     elseif (SANITIZE STREQUAL "undefined")
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SAN_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
         set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SAN_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
-        if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+        if (COMPILER_GCC)
+            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libubsan")
+            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libubsan")
             set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
-        endif()
-        if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
             set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libubsan")
         endif ()