Skip to content

Commit bd6783b

Browse files
committed
[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 cd173cb. Fixes #60115 Differential Revision: https://reviews.llvm.org/D142906
1 parent ccbab59 commit bd6783b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

compiler-rt/cmake/Modules/CompilerRTUtils.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,25 @@ function(get_compiler_rt_target arch variable)
433433
string(REGEX REPLACE "mipsisa64" "mipsisa32" triple_cpu_mips "${triple_cpu}")
434434
string(REGEX REPLACE "mips64" "mips" triple_cpu_mips "${triple_cpu_mips}")
435435
set(target "${triple_cpu_mips}${triple_suffix_gnu}")
436+
elseif("${arch}" MATCHES "^arm")
437+
# Arch is arm, armhf, armv6m (anything else would come from using
438+
# COMPILER_RT_DEFAULT_TARGET_ONLY, which is checked above).
439+
if (${arch} STREQUAL "armhf")
440+
# If we are building for hard float but our ABI is soft float.
441+
if ("${triple_suffix}" MATCHES ".*eabi$")
442+
# Change "eabi" -> "eabihf"
443+
set(triple_suffix "${triple_suffix}hf")
444+
endif()
445+
# ABI is already set in the triple, don't repeat it in the architecture.
446+
set(arch "arm")
447+
else ()
448+
# If we are building for soft float, but the triple's ABI is hard float.
449+
if ("${triple_suffix}" MATCHES ".*eabihf$")
450+
# Change "eabihf" -> "eabi"
451+
string(REGEX REPLACE "hf$" "" triple_suffix "${triple_suffix}")
452+
endif()
453+
endif()
454+
set(target "${arch}${triple_suffix}")
436455
else()
437456
set(target "${arch}${triple_suffix}")
438457
endif()

0 commit comments

Comments
 (0)