From d71ebb79aaa5a2a6c13255b44ee4178766cb2512 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Thu, 19 Dec 2024 16:26:40 +0100 Subject: [PATCH] asan cmake and frame pointer --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e9d53a..13697e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,9 +27,18 @@ option(TOMATO_TOX_AV "Build tomato with ToxAV" OFF) if (TOMATO_ASAN) if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") if (NOT WIN32) # exclude mingw - #link_libraries(-fsanitize=address) - link_libraries(-fsanitize=address,undefined) - #link_libraries(-fsanitize=undefined) + add_compile_options(-fno-omit-frame-pointer) + add_compile_options(-fsanitize=address,undefined) + #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) + #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) + link_libraries(-static-libasan) # make it "work" on nix message("II enabled ASAN") else()