[compiler-rt] r247099 - [CMake] Remove all uses of LLVM_NATIVE_ARCH.

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 16:13:48 PDT 2015


Author: samsonov
Date: Tue Sep  8 18:13:47 2015
New Revision: 247099

URL: http://llvm.org/viewvc/llvm-project?rev=247099&view=rev
Log:
[CMake] Remove all uses of LLVM_NATIVE_ARCH.

Instead, assume we're going to target triple specified by
COMPILER_RT_DEFAULT_TARGET_TRIPLE and build runtimes for this triple
(and hope that the host compiler can target them).

This will help users that use cross-compiler on their host to build
Clang that would work on a different architecture. This will also come in
handy if one would want to configure several compiler-rt build trees on
the same host, using just-built Clang that can target many
architectures.

This doesn't change the behavior in the default build configuration.

Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/cmake/config-ix.cmake
    compiler-rt/trunk/test/tsan/CMakeLists.txt

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=247099&r1=247098&r2=247099&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Tue Sep  8 18:13:47 2015
@@ -255,8 +255,7 @@ endif()
 # FIXME: Fix all sanitizers and add -Wframe-larger-than to
 # SANITIZER_COMMON_FLAGS
 if(COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG AND NOT COMPILER_RT_DEBUG
-   AND NOT ${LLVM_NATIVE_ARCH} STREQUAL "PowerPC"
-   AND NOT ${LLVM_NATIVE_ARCH} STREQUAL "Mips")
+   AND NOT ${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "powerpc|mips")
   set(SANITIZER_LIMIT_FRAME_SIZE TRUE)
 else()
   set(SANITIZER_LIMIT_FRAME_SIZE FALSE)

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=247099&r1=247098&r2=247099&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Tue Sep  8 18:13:47 2015
@@ -173,7 +173,7 @@ if(ANDROID)
   detect_target_arch()
   set(COMPILER_RT_OS_SUFFIX "-android")
 elseif(NOT APPLE) # Supported archs for Apple platforms are generated later
-  if("${LLVM_NATIVE_ARCH}" STREQUAL "X86")
+  if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "i[2-6]86|x86|amd64")
     if(NOT MSVC)
       test_target_arch(x86_64 "" "-m64")
       # FIXME: We build runtimes for both i686 and i386, as "clang -m32" may
@@ -188,27 +188,24 @@ elseif(NOT APPLE) # Supported archs for
         test_target_arch(x86_64 "" "")
       endif()
     endif()
-  elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
+  elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
     TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN)
     if(HOST_IS_BIG_ENDIAN)
       test_target_arch(powerpc64 "" "-m64")
     else()
       test_target_arch(powerpc64le "" "-m64")
     endif()
-  elseif("${LLVM_NATIVE_ARCH}" STREQUAL "Mips")
+  elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mipsel|mips64el")
     # Gcc doesn't accept -m32/-m64 so we do the next best thing and use
     # -mips32r2/-mips64r2. We don't use -mips1/-mips3 because we want to match
     # clang's default CPU's. In the 64-bit case, we must also specify the ABI
     # since the default ABI differs between gcc and clang.
     # FIXME: Ideally, we would build the N32 library too.
-    if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mipsel|mips64el")
-      # regex for mipsel, mips64el
-      test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu")
-      test_target_arch(mips64el "" "-mips64r2" "-mabi=n64")
-    else()
-      test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
-      test_target_arch(mips64 "" "-mips64r2" "-mabi=n64")
-    endif()
+    test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu")
+    test_target_arch(mips64el "" "-mips64r2" "-mabi=n64")
+  elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
+    test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
+    test_target_arch(mips64 "" "-mips64r2" "-mabi=n64")
   elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm")
     test_target_arch(arm "" "-march=armv7-a")
   elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch32")
@@ -523,7 +520,7 @@ endif()
 # message with -msse3. But check_c_compiler_flags() checks only for
 # compiler error messages. Therefore COMPILER_RT_HAS_MSSE3_FLAG turns out to be
 # true on Mips, so we make it false here.
-if("${LLVM_NATIVE_ARCH}" STREQUAL "Mips")
+if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
   set(COMPILER_RT_HAS_MSSE3_FLAG FALSE)
 endif()
 

Modified: compiler-rt/trunk/test/tsan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/CMakeLists.txt?rev=247099&r1=247098&r2=247099&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/CMakeLists.txt (original)
+++ compiler-rt/trunk/test/tsan/CMakeLists.txt Tue Sep  8 18:13:47 2015
@@ -1,5 +1,5 @@
 set(TSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
-if(NOT ${LLVM_NATIVE_ARCH} STREQUAL "Mips")
+if(NOT ${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "mips")
   list(APPEND TSAN_TEST_DEPS GotsanRuntimeCheck)
 endif()
 if(NOT COMPILER_RT_STANDALONE_BUILD)




More information about the llvm-commits mailing list