From cf2d4b8ea4b3aca20671034b4a530a3a7b16e1dc Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Tue, 11 Nov 2014 13:44:08 +0000 Subject: [PATCH] [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 --- compiler-rt/lib/asan/tests/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/asan/tests/CMakeLists.txt b/compiler-rt/lib/asan/tests/CMakeLists.txt index 701c630c46a4..34badd877be5 100644 --- a/compiler-rt/lib/asan/tests/CMakeLists.txt +++ b/compiler-rt/lib/asan/tests/CMakeLists.txt @@ -51,8 +51,10 @@ set(ASAN_UNITTEST_INSTRUMENTED_CFLAGS ${ASAN_UNITTEST_COMMON_CFLAGS} -fsanitize=address "-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) list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS --driver-mode=g++)