[PATCH] D50548: [CMake] Don't parse target triple except for arch

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 13 19:44:21 PDT 2018


phosek updated this revision to Diff 160508.
phosek marked 3 inline comments as done.

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D50548

Files:
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/Modules/CompilerRTUtils.cmake


Index: compiler-rt/cmake/Modules/CompilerRTUtils.cmake
===================================================================
--- compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -276,11 +276,6 @@
 
   string(REPLACE "-" ";" TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
   list(GET TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH)
-  list(GET TARGET_TRIPLE_LIST 1 COMPILER_RT_DEFAULT_TARGET_OS)
-  list(LENGTH TARGET_TRIPLE_LIST TARGET_TRIPLE_LIST_LENGTH)
-  if(TARGET_TRIPLE_LIST_LENGTH GREATER 2)
-    list(GET TARGET_TRIPLE_LIST 2 COMPILER_RT_DEFAULT_TARGET_ABI)
-  endif()
   # Determine if test target triple is specified explicitly, and doesn't match the
   # default.
   if(NOT COMPILER_RT_DEFAULT_TARGET_TRIPLE STREQUAL TARGET_TRIPLE)
@@ -320,13 +315,12 @@
 endfunction()
 
 function(get_compiler_rt_target arch variable)
+  string(FIND ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} "-" dash_index)
+  string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${dash_index} -1 triple_suffix)
   if(ANDROID AND ${arch} STREQUAL "i386")
-    set(target "i686${COMPILER_RT_OS_SUFFIX}-${COMPILER_RT_DEFAULT_TARGET_OS}")
+    set(target "i686${COMPILER_RT_OS_SUFFIX}${triple_suffix}")
   else()
-    set(target "${arch}-${COMPILER_RT_DEFAULT_TARGET_OS}")
-  endif()
-  if(COMPILER_RT_DEFAULT_TARGET_ABI)
-    set(target "${target}-${COMPILER_RT_DEFAULT_TARGET_ABI}")
+    set(target "${arch}${triple_suffix}")
   endif()
   set(${variable} ${target} PARENT_SCOPE)
 endfunction()
Index: compiler-rt/CMakeLists.txt
===================================================================
--- compiler-rt/CMakeLists.txt
+++ compiler-rt/CMakeLists.txt
@@ -89,12 +89,12 @@
 endif()
 
 construct_compiler_rt_default_triple()
-if ("${COMPILER_RT_DEFAULT_TARGET_ABI}" MATCHES "hf$")
+if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*hf$")
   if (${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "^arm")
     set(COMPILER_RT_DEFAULT_TARGET_ARCH "armhf")
   endif()
 endif()
-if ("${COMPILER_RT_DEFAULT_TARGET_ABI}" MATCHES "^android")
+if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*android.*")
   set(ANDROID 1)
 endif()
 pythonize_bool(ANDROID)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50548.160508.patch
Type: text/x-patch
Size: 2197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180814/6eb3aa2d/attachment.bin>


More information about the llvm-commits mailing list