diff options
-rw-r--r-- | CMakeLists.txt | 32 | ||||
-rw-r--r-- | cmake/Modules/CompilerRTUtils.cmake | 6 | ||||
-rw-r--r-- | lib/asan/CMakeLists.txt | 18 | ||||
-rw-r--r-- | lib/asan/tests/CMakeLists.txt | 16 | ||||
-rw-r--r-- | lib/dfsan/CMakeLists.txt | 4 | ||||
-rw-r--r-- | lib/msan/CMakeLists.txt | 4 | ||||
-rw-r--r-- | lib/msan/tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/sanitizer_common/CMakeLists.txt | 4 | ||||
-rw-r--r-- | lib/sanitizer_common/tests/CMakeLists.txt | 8 | ||||
-rw-r--r-- | lib/tsan/CMakeLists.txt | 6 | ||||
-rw-r--r-- | lib/tsan/dd/CMakeLists.txt | 4 |
11 files changed, 52 insertions, 52 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 777c6fe07..3da2eb0dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -233,14 +233,14 @@ if(NOT COMPILER_RT_HAS_FUNC_SYMBOL) endif() # Provide some common commmandline flags for Sanitizer runtimes. -append_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_FNO_BUILTIN_FLAG -fno-builtin SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG -fomit-frame-pointer SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_FUNWIND_TABLES_FLAG -funwind-tables SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG -fno-stack-protector SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG -fno-function-sections SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FNO_BUILTIN_FLAG -fno-builtin SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG -fomit-frame-pointer SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FUNWIND_TABLES_FLAG -funwind-tables SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG -fno-stack-protector SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG -fno-function-sections SANITIZER_COMMON_CFLAGS) if(MSVC) # Replace the /MD[d] flags with /MT. @@ -251,8 +251,8 @@ if(MSVC) string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") endif() - append_if(COMPILER_RT_HAS_Oy_FLAG /Oy- SANITIZER_COMMON_CFLAGS) - append_if(COMPILER_RT_HAS_GS_FLAG /GS- SANITIZER_COMMON_CFLAGS) + append_list_if(COMPILER_RT_HAS_Oy_FLAG /Oy- SANITIZER_COMMON_CFLAGS) + append_list_if(COMPILER_RT_HAS_GS_FLAG /GS- SANITIZER_COMMON_CFLAGS) endif() # Build with optimization, unless we're in debug mode. If we're using MSVC, @@ -271,12 +271,12 @@ elseif(COMPILER_RT_HAS_Zi_FLAG) endif() # Turn off several warnings. -append_if(COMPILER_RT_HAS_WNO_GNU_FLAG -Wno-gnu SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG -Wno-variadic-macros SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_WNO_C99_EXTENSIONS_FLAG -Wno-c99-extensions SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_WNO_NON_VIRTUAL_DTOR_FLAG -Wno-non-virtual-dtor SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_WD4391_FLAG /wd4391 SANITIZER_COMMON_CFLAGS) -append_if(COMPILER_RT_HAS_WD4722_FLAG /wd4722 SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_WNO_GNU_FLAG -Wno-gnu SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG -Wno-variadic-macros SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_WNO_C99_EXTENSIONS_FLAG -Wno-c99-extensions SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_WNO_NON_VIRTUAL_DTOR_FLAG -Wno-non-virtual-dtor SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_WD4391_FLAG /wd4391 SANITIZER_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_WD4722_FLAG /wd4722 SANITIZER_COMMON_CFLAGS) if(APPLE) # Obtain the iOS Simulator SDK path from xcodebuild. diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake index f355627a5..1eb8f2e3a 100644 --- a/cmake/Modules/CompilerRTUtils.cmake +++ b/cmake/Modules/CompilerRTUtils.cmake @@ -26,7 +26,7 @@ macro(pythonize_bool var) endmacro() # Appends value to all lists in ARGN, if the condition is true. -macro(append_if condition value) +macro(append_list_if condition value) if(${condition}) foreach(list ${ARGN}) list(APPEND ${list} ${value}) @@ -44,6 +44,6 @@ macro(append_string_if condition value) endmacro() macro(append_no_rtti_flag list) - append_if(COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti ${list}) - append_if(COMPILER_RT_HAS_GR_FLAG /GR- ${list}) + append_list_if(COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti ${list}) + append_list_if(COMPILER_RT_HAS_GR_FLAG /GR- ${list}) endmacro() diff --git a/lib/asan/CMakeLists.txt b/lib/asan/CMakeLists.txt index 4f5b01b24..6dd871f56 100644 --- a/lib/asan/CMakeLists.txt +++ b/lib/asan/CMakeLists.txt @@ -53,20 +53,20 @@ endif() set(ASAN_DYNAMIC_DEFINITIONS ${ASAN_COMMON_DEFINITIONS} ASAN_DYNAMIC=1) -append_if(WIN32 INTERCEPTION_DYNAMIC_CRT ASAN_DYNAMIC_DEFINITIONS) +append_list_if(WIN32 INTERCEPTION_DYNAMIC_CRT ASAN_DYNAMIC_DEFINITIONS) set(ASAN_DYNAMIC_CFLAGS ${ASAN_CFLAGS}) -append_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC +append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC -ftls-model=initial-exec ASAN_DYNAMIC_CFLAGS) -append_if(MSVC /DEBUG ASAN_DYNAMIC_CFLAGS) +append_list_if(MSVC /DEBUG ASAN_DYNAMIC_CFLAGS) -append_if(COMPILER_RT_HAS_LIBC c ASAN_DYNAMIC_LIBS) -append_if(COMPILER_RT_HAS_LIBDL dl ASAN_DYNAMIC_LIBS) -append_if(COMPILER_RT_HAS_LIBM m ASAN_DYNAMIC_LIBS) -append_if(COMPILER_RT_HAS_LIBPTHREAD pthread ASAN_DYNAMIC_LIBS) -append_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ ASAN_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBC c ASAN_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBDL dl ASAN_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBM m ASAN_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread ASAN_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ ASAN_DYNAMIC_LIBS) -append_if(ANDROID log ASAN_DYNAMIC_LIBS) +append_list_if(ANDROID log ASAN_DYNAMIC_LIBS) # Compile ASan sources into an object library. if(APPLE) diff --git a/lib/asan/tests/CMakeLists.txt b/lib/asan/tests/CMakeLists.txt index cef6fbceb..701c630c4 100644 --- a/lib/asan/tests/CMakeLists.txt +++ b/lib/asan/tests/CMakeLists.txt @@ -31,7 +31,7 @@ set(ASAN_UNITTEST_COMMON_CFLAGS -O2 -Wno-format -Werror=sign-compare) -append_if(COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG -Wno-variadic-macros ASAN_UNITTEST_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG -Wno-variadic-macros ASAN_UNITTEST_COMMON_CFLAGS) # -gline-tables-only must be enough for ASan, so use it if possible. if(COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang") @@ -81,20 +81,20 @@ set(ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINKFLAGS set(ASAN_UNITTEST_INSTRUMENTED_LIBS) # NDK r10 requires -latomic almost always. -append_if(ANDROID atomic ASAN_UNITTEST_INSTRUMENTED_LIBS) +append_list_if(ANDROID atomic ASAN_UNITTEST_INSTRUMENTED_LIBS) set(ASAN_UNITTEST_NOINST_LINKFLAGS ${ASAN_UNITTEST_COMMON_LINKFLAGS}) -append_if(COMPILER_RT_HAS_LIBM -lm ASAN_UNITTEST_NOINST_LINKFLAGS) -append_if(COMPILER_RT_HAS_LIBDL -ldl ASAN_UNITTEST_NOINST_LINKFLAGS) -append_if(COMPILER_RT_HAS_LIBPTHREAD -pthread ASAN_UNITTEST_NOINST_LINKFLAGS) -append_if(COMPILER_RT_HAS_LIBPTHREAD -pthread +append_list_if(COMPILER_RT_HAS_LIBM -lm ASAN_UNITTEST_NOINST_LINKFLAGS) +append_list_if(COMPILER_RT_HAS_LIBDL -ldl ASAN_UNITTEST_NOINST_LINKFLAGS) +append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread ASAN_UNITTEST_NOINST_LINKFLAGS) +append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread ASAN_DYNAMIC_UNITTEST_INSTRUMENTED_LINKFLAGS) # TODO(eugenis): move all -l flags above to _LIBS? set(ASAN_UNITTEST_NOINST_LIBS) -append_if(ANDROID log ASAN_UNITTEST_NOINST_LIBS) +append_list_if(ANDROID log ASAN_UNITTEST_NOINST_LIBS) # NDK r10 requires -latomic almost always. -append_if(ANDROID atomic ASAN_UNITTEST_NOINST_LIBS) +append_list_if(ANDROID atomic ASAN_UNITTEST_NOINST_LIBS) # Compile source for the given architecture, using compiler # options in ${ARGN}, and add it to the object list. diff --git a/lib/dfsan/CMakeLists.txt b/lib/dfsan/CMakeLists.txt index bb73d29d1..173774fd3 100644 --- a/lib/dfsan/CMakeLists.txt +++ b/lib/dfsan/CMakeLists.txt @@ -7,14 +7,14 @@ set(DFSAN_RTL_SOURCES dfsan_interceptors.cc) set(DFSAN_COMMON_CFLAGS ${SANITIZER_COMMON_CFLAGS}) # Prevent clang from generating libc calls. -append_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding DFSAN_COMMON_CFLAGS) +append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding DFSAN_COMMON_CFLAGS) # Static runtime library. add_custom_target(dfsan) set(arch "x86_64") if(CAN_TARGET_${arch}) set(DFSAN_CFLAGS ${DFSAN_COMMON_CFLAGS}) - append_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS) + append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE DFSAN_CFLAGS) add_compiler_rt_runtime(clang_rt.dfsan-${arch} ${arch} STATIC SOURCES ${DFSAN_RTL_SOURCES} $<TARGET_OBJECTS:RTInterception.${arch}> diff --git a/lib/msan/CMakeLists.txt b/lib/msan/CMakeLists.txt index 4d69a2548..9d1bacb84 100644 --- a/lib/msan/CMakeLists.txt +++ b/lib/msan/CMakeLists.txt @@ -14,9 +14,9 @@ set(MSAN_RTL_SOURCES set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS}) append_no_rtti_flag(MSAN_RTL_CFLAGS) -append_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS) +append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS) # Prevent clang from generating libc calls. -append_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS) +append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS) set(MSAN_RUNTIME_LIBRARIES) diff --git a/lib/msan/tests/CMakeLists.txt b/lib/msan/tests/CMakeLists.txt index c65461517..f3c11ba7e 100644 --- a/lib/msan/tests/CMakeLists.txt +++ b/lib/msan/tests/CMakeLists.txt @@ -48,7 +48,7 @@ set(MSAN_UNITTEST_LINK_FLAGS -lstdc++ ) -append_if(COMPILER_RT_HAS_LIBDL -ldl MSAN_UNITTEST_LINK_FLAGS) +append_list_if(COMPILER_RT_HAS_LIBDL -ldl MSAN_UNITTEST_LINK_FLAGS) set(MSAN_LOADABLE_LINK_FLAGS -fsanitize=memory -shared diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt index 5eeb64e2a..535a045db 100644 --- a/lib/sanitizer_common/CMakeLists.txt +++ b/lib/sanitizer_common/CMakeLists.txt @@ -105,9 +105,9 @@ append_no_rtti_flag(SANITIZER_CFLAGS) # Stack frames on PowerPC are much larger than anticipated. if(NOT ${LLVM_NATIVE_ARCH} STREQUAL "PowerPC") - append_if(COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG -Wframe-larger-than=512 SANITIZER_CFLAGS) + append_list_if(COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG -Wframe-larger-than=512 SANITIZER_CFLAGS) endif() -append_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors SANITIZER_CFLAGS) +append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors SANITIZER_CFLAGS) add_custom_target(sanitizer_common) set(SANITIZER_RUNTIME_LIBRARIES) diff --git a/lib/sanitizer_common/tests/CMakeLists.txt b/lib/sanitizer_common/tests/CMakeLists.txt index 40725ad72..c8989236e 100644 --- a/lib/sanitizer_common/tests/CMakeLists.txt +++ b/lib/sanitizer_common/tests/CMakeLists.txt @@ -58,12 +58,12 @@ if(NOT MSVC) endif() set(SANITIZER_TEST_LINK_LIBS) -append_if(ANDROID log SANITIZER_TEST_LINK_LIBS) +append_list_if(ANDROID log SANITIZER_TEST_LINK_LIBS) # NDK r10 requires -latomic almost always. -append_if(ANDROID atomic SANITIZER_TEST_LINK_LIBS) +append_list_if(ANDROID atomic SANITIZER_TEST_LINK_LIBS) -append_if(COMPILER_RT_HAS_LIBDL -ldl SANITIZER_TEST_LINK_FLAGS_COMMON) -append_if(COMPILER_RT_HAS_LIBPTHREAD -pthread SANITIZER_TEST_LINK_FLAGS_COMMON) +append_list_if(COMPILER_RT_HAS_LIBDL -ldl SANITIZER_TEST_LINK_FLAGS_COMMON) +append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread SANITIZER_TEST_LINK_FLAGS_COMMON) # x86_64 FreeBSD 9.2 additionally requires libc++ to build the tests. Also, # 'libm' shall be specified explicitly to build i386 tests. if(CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE") diff --git a/lib/tsan/CMakeLists.txt b/lib/tsan/CMakeLists.txt index 3d53de994..6d51faa18 100644 --- a/lib/tsan/CMakeLists.txt +++ b/lib/tsan/CMakeLists.txt @@ -5,12 +5,12 @@ include_directories(..) set(TSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS}) # SANITIZER_COMMON_CFLAGS contains -fPIC, but it's performance-critical for # TSan runtime to be built with -fPIE to reduce the number of register spills. -append_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE TSAN_CFLAGS) +append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE TSAN_CFLAGS) append_no_rtti_flag(TSAN_CFLAGS) set(TSAN_RTL_CFLAGS ${TSAN_CFLAGS}) -append_if(COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG -Wframe-larger-than=512 TSAN_RTL_CFLAGS) -append_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors TSAN_RTL_CFLAGS) +append_list_if(COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG -Wframe-larger-than=512 TSAN_RTL_CFLAGS) +append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors TSAN_RTL_CFLAGS) # FIXME: Add support for --sysroot=. compile flag: if("${CMAKE_BUILD_TYPE}" EQUAL "Release") diff --git a/lib/tsan/dd/CMakeLists.txt b/lib/tsan/dd/CMakeLists.txt index 0c9f601dc..aa7d63d38 100644 --- a/lib/tsan/dd/CMakeLists.txt +++ b/lib/tsan/dd/CMakeLists.txt @@ -23,8 +23,8 @@ set(DD_HEADERS ) set(DD_LINKLIBS) -append_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS) -append_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS) +append_list_if(COMPILER_RT_HAS_LIBDL dl DD_LINKLIBS) +append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread DD_LINKLIBS) add_custom_target(dd) # Deadlock detector is currently supported on 64-bit Linux only. |