When using ASAN, disable stack protection and source fortification

ASAN throws some false positive errors on stack overflows when
used with the stack protector option, and doesn't support source
fortification.
This commit is contained in:
Ian McInerney 2020-03-18 19:12:24 +00:00
parent 64d217edda
commit d787596124
1 changed files with 3 additions and 0 deletions

View File

@ -350,6 +350,9 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
if( KICAD_SANITIZE )
add_definitions( -DKICAD_SANITIZE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_SANITIZE_VECTOR -fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer" )
# ASAN shouldn't be used with these options (https://github.com/google/sanitizers/wiki/AddressSanitizer#faq)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector -U_FORTIFY_SOURCE" )
endif()
if( KICAD_STDLIB_DEBUG )