[libc-commits] [libc] [libc][cmake] pass -mthumb for thumb triples (PR #96550)
via libc-commits
libc-commits at lists.llvm.org
Mon Jun 24 13:27:31 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Nick Desaulniers (paternity leave) (nickdesaulniers)
<details>
<summary>Changes</summary>
Allows cross compiling for 32b ARM in thumb mode via
`-DLIBC_TARGET_TRIPLE=thumbv7-linux-gnueabihf`. Strangely, setting that target
triple doesn't imply `-mthumb`, so set that when using a triple that starts
with "thumb". Android only cares about building llvm-libc for 32b ARM in thumb
mode, so we need to ensure this target builds (it doesn't, but with this change
we can at least configure then start working through the build issues) and is
continuously tested.
---
Full diff: https://github.com/llvm/llvm-project/pull/96550.diff
1 Files Affected:
- (modified) libc/cmake/modules/LLVMLibCArchitectures.cmake (+4-1)
``````````diff
diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake b/libc/cmake/modules/LLVMLibCArchitectures.cmake
index dacb4db75d337..5acc35569b5ed 100644
--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake
+++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake
@@ -33,7 +33,7 @@ function(get_arch_and_system_from_triple triple arch_var sys_var)
# value.
if(target_arch MATCHES "^mips")
set(target_arch "mips")
- elseif(target_arch MATCHES "^arm")
+ elseif(target_arch MATCHES "^arm" OR target_arch MATCHES "^thumb")
# TODO(lntue): Shall we separate `arm64`? It is currently recognized as
# `arm` here.
set(target_arch "arm")
@@ -203,6 +203,9 @@ if(explicit_target_triple AND
else()
list(APPEND
LIBC_COMPILE_OPTIONS_DEFAULT "--target=${explicit_target_triple}")
+ if (explicit_target_triple MATCHES "^thumb")
+ list(APPEND LIBC_COMPILE_OPTIONS_DEFAULT "-mthumb")
+ endif()
endif()
endif()
``````````
</details>
https://github.com/llvm/llvm-project/pull/96550
More information about the libc-commits
mailing list