Skip to content

Commit 8bd2722

Browse files
committed
[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
1 parent 74bece8 commit 8bd2722

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

compiler-rt/cmake/Modules/CompilerRTUtils.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,21 @@ macro(construct_compiler_rt_default_triple)
326326

327327
string(REPLACE "-" ";" TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
328328
list(GET TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH)
329+
330+
# Map various forms of the architecture names to the canonical forms
331+
# (as they are used by clang, see getArchNameForCompilerRTLib).
332+
if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "^i.86$")
333+
# Android uses i686, but that's remapped at a later stage.
334+
set(COMPILER_RT_DEFAULT_TARGET_ARCH "i386")
335+
elseif ("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "^arm" AND
336+
NOT "${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "^arm64")
337+
if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*hf$")
338+
set(COMPILER_RT_DEFAULT_TARGET_ARCH "armhf")
339+
else()
340+
set(COMPILER_RT_DEFAULT_TARGET_ARCH "arm")
341+
endif()
342+
endif()
343+
329344
# Determine if test target triple is specified explicitly, and doesn't match the
330345
# default.
331346
if(NOT COMPILER_RT_DEFAULT_TARGET_TRIPLE STREQUAL TARGET_TRIPLE)

0 commit comments

Comments
 (0)