[compiler-rt] [CMake][compiler-rt] Move the armhf target rewriting (PR #174181)
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 1 23:07:37 PST 2026
https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/174181
There's an existing logic in construct_compiler_rt_default_triple for mapping COMPILER_RT_DEFAULT_TARGET_ARCH, move the armhf handling to the same macro for consistency.
>From cade846e99bc5ecfc6994dadd39f4520368143aa Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Fri, 2 Jan 2026 07:05:05 +0000
Subject: [PATCH] [CMake][compiler-rt] Move the armhf target rewriting
There's an existing logic in construct_compiler_rt_default_triple for
mapping COMPILER_RT_DEFAULT_TARGET_ARCH, move the armhf handling to the
same macro for consistency.
---
compiler-rt/CMakeLists.txt | 7 +------
compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 7 +++++++
compiler-rt/cmake/base-config-ix.cmake | 1 +
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index a92258ae12446..ea174f234f0d9 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -147,12 +147,7 @@ if (COMPILER_RT_STANDALONE_BUILD)
endif()
construct_compiler_rt_default_triple()
-if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*hf$")
- if (${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "^arm")
- set(COMPILER_RT_DEFAULT_TARGET_ARCH "armhf")
- CHECK_SYMBOL_EXISTS (__thumb__ "" COMPILER_RT_ARM_THUMB)
- endif()
-endif()
+
if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*android.*")
set(ANDROID 1)
string(REGEX MATCH "-target(=| +)[^ ]+android[a-z]*([0-9]+)" ANDROID_API_LEVEL "${CMAKE_C_FLAGS}")
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index cbd18d26c0b93..658f15855ab8b 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -410,6 +410,13 @@ macro(construct_compiler_rt_default_triple)
# Android uses i686, but that's remapped at a later stage.
set(COMPILER_RT_DEFAULT_TARGET_ARCH "i386")
endif()
+ if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "^arm")
+ if("${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" MATCHES ".*hf$")
+ if(NOT LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set(COMPILER_RT_DEFAULT_TARGET_ARCH "armhf")
+ endif()
+ endif()
+ endif()
# If we are directly targeting a GPU we need to check that the compiler is
# compatible and pass some default arguments.
diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index 37dfa5534dfef..5c1389ccb8cce 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -281,6 +281,7 @@ macro(test_targets)
test_target_arch(arm "" "-march=armv7-a" "-mfloat-abi=soft")
test_target_arch(armhf "" "-march=armv7-a" "-mfloat-abi=hard")
endif()
+ check_symbol_exists(__thumb__ "" COMPILER_RT_ARM_THUMB)
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "avr")
test_target_arch(avr "__AVR__" "--target=avr")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch32")
More information about the llvm-commits
mailing list