From d2b5f6caa403ac1163b0266a1a113f0d44a54254 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sat, 10 Jan 2026 13:46:24 +0100 Subject: [PATCH] fix asan option for gcc --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab02ef0..81c3777 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,13 +31,21 @@ if (TOMATO_ASAN) if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") if (NOT WIN32) # exclude mingw add_compile_options(-fno-omit-frame-pointer) - add_compile_options(-fsanitize=address,undefined,nullability) + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + add_compile_options(-fsanitize=address,undefined,nullability) + else() + add_compile_options(-fsanitize=address,undefined) + endif() #add_compile_options(-fsanitize=address,undefined,pointer-compare,pointer-subtract) #add_compile_options(-fhardened) #add_compile_options(-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full) add_link_options(-fno-omit-frame-pointer) - add_link_options(-fsanitize=address,undefined,nullability) + if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + add_link_options(-fsanitize=address,undefined,nullability) + else() + add_link_options(-fsanitize=address,undefined) + endif8) #add_link_options(-fsanitize=address,undefined,pointer-compare,pointer-subtract) #add_link_options(-fhardened) #add_link_options(-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,-z,now -fstack-protector-strong -fstack-clash-protection -fcf-protection=full)