[compiler-rt] 98033fd - sanitizer_common: Fix build for tests

Mitch Phillips via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 15:50:08 PDT 2021


Author: Marco Elver
Date: 2021-07-12T15:49:40-07:00
New Revision: 98033fdc50e61273b1d5c77ba5f0f75afe3965c1

URL: https://github.com/llvm/llvm-project/commit/98033fdc50e61273b1d5c77ba5f0f75afe3965c1
DIFF: https://github.com/llvm/llvm-project/commit/98033fdc50e61273b1d5c77ba5f0f75afe3965c1.diff

LOG: sanitizer_common: Fix build for tests

It turns out that COMPILER_RT_TEST_COMPILER_CFLAGS is actually a string
that is being appended to and not a list.

Therefore, append the thread-safety flags to the string. Because CMake
separates list elements by ';' when turning into a string, also
substitute ';' with ' '.

Reviewed By: hctim

Differential Revision: https://reviews.llvm.org/D105829

Added: 
    

Modified: 
    compiler-rt/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 1610bbd2312a..84429052af5e 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -366,7 +366,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
       "-Werror=thread-safety-beta"
   )
   list(APPEND SANITIZER_COMMON_CFLAGS ${THREAD_SAFETY_FLAGS})
-  list(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS ${THREAD_SAFETY_FLAGS})
+  string(REPLACE ";" " " thread_safety_flags_space_sep "${THREAD_SAFETY_FLAGS}")
+  string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " ${thread_safety_flags_space_sep}")
 endif()
 
 # If we're using MSVC,


        


More information about the llvm-commits mailing list