Add -fsantize to link flags. (#2506)

The option "SPIRV_USE_SANITIZER=address" does not work as stated in our
documentation because the link step fails for the tools.  We have to add
-fsanitize to the link flags so the correct libraries are added on the
link step.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/2482.
This commit is contained in:
Steven Perron 2019-04-11 16:33:26 -04:00 committed by David Neto
parent 82ebbbba15
commit 2b46521cd7
2 changed files with 3 additions and 1 deletions

View File

@ -140,6 +140,8 @@ function(spvtools_default_compile_options TARGET)
if(NOT "${SPIRV_USE_SANITIZER}" STREQUAL "")
target_compile_options(${TARGET} PRIVATE
-fsanitize=${SPIRV_USE_SANITIZER})
set_target_properties(${TARGET} PROPERTIES
LINK_FLAGS -fsanitize=${SPIRV_USE_SANITIZER})
endif()
target_compile_options(${TARGET} PRIVATE
-ftemplate-depth=1024)

View File

@ -46,7 +46,7 @@ fi
ADDITIONAL_CMAKE_FLAGS=""
if [ $CONFIG = "ASAN" ]
then
ADDITIONAL_CMAKE_FLAGS="-DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_C_FLAGS=-fsanitize=address"
ADDITIONAL_CMAKE_FLAGS="SPIRV_USE_SANITIZER=address"
[ $COMPILER = "clang" ] || { echo "$CONFIG requires clang"; exit 1; }
elif [ $CONFIG = "COVERAGE" ]
then