diff options
author | Leandro Lupori <leandro.lupori@linaro.org> | 2023-04-18 16:55:42 +0000 |
---|---|---|
committer | Leandro Lupori <leandro.lupori@linaro.org> | 2023-04-27 11:10:43 +0000 |
commit | bd6783b380768bd35f37e0034dccf6c5736dd031 (patch) | |
tree | baca1c8e1a0a875d7918b34167edbbe52867ea26 | |
parent | ccbab5979b7bd594314b50f4fc54ec57a676f391 (diff) | |
download | llvm-bd6783b380768bd35f37e0034dccf6c5736dd031.tar.gz |
[compiler-rt] Fix invalid triple on ARM build
The fuzzer build was failing on armv7l, with an invalid triple
error. This happened because CMake's get_compiler_rt_target
function was missing some code to correctly handle arm archs,
such as armhf.
This was originaly part of https://reviews.llvm.org/D140011, that
landed on main with commit cd173cbd7cca69c29df42cd4b42e60433435c29b.
Fixes #60115
Differential Revision: https://reviews.llvm.org/D142906
-rw-r--r-- | compiler-rt/cmake/Modules/CompilerRTUtils.cmake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake index 4c85551d7766..eefc466a4610 100644 --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -433,6 +433,25 @@ function(get_compiler_rt_target arch variable) string(REGEX REPLACE "mipsisa64" "mipsisa32" triple_cpu_mips "${triple_cpu}") string(REGEX REPLACE "mips64" "mips" triple_cpu_mips "${triple_cpu_mips}") set(target "${triple_cpu_mips}${triple_suffix_gnu}") + elseif("${arch}" MATCHES "^arm") + # Arch is arm, armhf, armv6m (anything else would come from using + # COMPILER_RT_DEFAULT_TARGET_ONLY, which is checked above). + if (${arch} STREQUAL "armhf") + # If we are building for hard float but our ABI is soft float. + if ("${triple_suffix}" MATCHES ".*eabi$") + # Change "eabi" -> "eabihf" + set(triple_suffix "${triple_suffix}hf") + endif() + # ABI is already set in the triple, don't repeat it in the architecture. + set(arch "arm") + else () + # If we are building for soft float, but the triple's ABI is hard float. + if ("${triple_suffix}" MATCHES ".*eabihf$") + # Change "eabihf" -> "eabi" + string(REGEX REPLACE "hf$" "" triple_suffix "${triple_suffix}") + endif() + endif() + set(target "${arch}${triple_suffix}") else() set(target "${arch}${triple_suffix}") endif() |