[compiler-rt] 8bd2722 - [compiler-rt] Normalize i?86 to i386 and armv* to arm for COMPILER_RT_DEFAULT_TARGET_ARCH

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 22:44:31 PST 2021


Author: Martin Storsjö
Date: 2021-03-10T08:43:54+02:00
New Revision: 8bd2722f65cfd7883ed9769f7bad3ff50e4c6905

URL: https://github.com/llvm/llvm-project/commit/8bd2722f65cfd7883ed9769f7bad3ff50e4c6905
DIFF: https://github.com/llvm/llvm-project/commit/8bd2722f65cfd7883ed9769f7bad3ff50e4c6905.diff

LOG: [compiler-rt] Normalize i?86 to i386 and armv* to arm for COMPILER_RT_DEFAULT_TARGET_ARCH

This corresponds to getArchNameForCompilerRTLib in clang; any
32 bit x86 architecture triple (except on android, but those
exceptions are already handled in compiler-rt on a different level)
get the compiler rt library names with i386; arm targets get either
"arm" or "armhf". (Mapping to "armhf" is handled in the toplevel
CMakeLists.txt.)

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

Added: 
    

Modified: 
    compiler-rt/cmake/Modules/CompilerRTUtils.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index f61d487e93a0..64bedb278d9f 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -326,6 +326,21 @@ macro(construct_compiler_rt_default_triple)
 
   string(REPLACE "-" ";" TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
   list(GET TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH)
+
+  # Map various forms of the architecture names to the canonical forms
+  # (as they are used by clang, see getArchNameForCompilerRTLib).
+  if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "^i.86$")
+    # Android uses i686, but that's remapped at a later stage.
+    set(COMPILER_RT_DEFAULT_TARGET_ARCH "i386")
+  elseif ("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "^arm" AND
+          NOT "${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "^arm64")
+    if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*hf$")
+      set(COMPILER_RT_DEFAULT_TARGET_ARCH "armhf")
+    else()
+      set(COMPILER_RT_DEFAULT_TARGET_ARCH "arm")
+    endif()
+  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)


        


More information about the llvm-commits mailing list