[ASan] Fix use of -asan-instrument-assembly in tests

Summary:
The option -asan-instrument-assembly is declared in the X86 backend.
If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=All then the
option is tolerated but ignored.
If I test on PowerPC configured with LLVM_TARGETS_TO_BUILD=PowerPC then
the testsuite fails with:
[ 93%] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64-inline.o
clang (LLVM option parsing): Unknown command line argument '-asan-instrument-assembly'.  Try: 'clang (LLVM option parsing) -help'

Fix this inconsistency by only adding the option if that toolchain was
built with the X86 backend included.

Reviewers: kcc, samsonov, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6190

llvm-svn: 221687
This commit is contained in:
Jay Foad 2014-11-11 13:44:08 +00:00
parent b2dd15f8c7
commit cf2d4b8ea4
1 changed files with 3 additions and 1 deletions

View File

@ -51,8 +51,10 @@ set(ASAN_UNITTEST_INSTRUMENTED_CFLAGS
${ASAN_UNITTEST_COMMON_CFLAGS} ${ASAN_UNITTEST_COMMON_CFLAGS}
-fsanitize=address -fsanitize=address
"-fsanitize-blacklist=${ASAN_BLACKLIST_FILE}" "-fsanitize-blacklist=${ASAN_BLACKLIST_FILE}"
-mllvm -asan-instrument-assembly
) )
if(CAN_TARGET_x86_64 OR CAN_TARGET_i386)
list(APPEND ASAN_UNITTEST_INSTRUMENTED_CFLAGS -mllvm -asan-instrument-assembly)
endif()
if(NOT MSVC) if(NOT MSVC)
list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS --driver-mode=g++) list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS --driver-mode=g++)