Skip to content

Commit 163d5b2

Browse files
committed
Only use normalized target triple for compiler-rt
A newlib overlay build does not recognise a target triple as normalized by clang, however compiler-rt build needs the normalized triple to find the correct output directory. So this patch uses the normalized triple only for compiler-rt.
1 parent f73784f commit 163d5b2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ function(
859859
# Exceptions are architectures pre-armv7, which compiler-rt expects to
860860
# see in the triple because that's where it looks to decide whether to
861861
# use specific assembly sources.
862-
if(NOT target_triple MATCHES "^(aarch64-none-unknown-elf|arm-none-unknown-eabi|armv[4-6])")
862+
if(NOT target_triple MATCHES "^(aarch64-none-elf|arm-none-eabi|armv[4-6])")
863863
message(FATAL_ERROR "\
864864
Target triple name \"${target_triple}\" not compatible with compiler-rt.
865865
Use -march to specify the architecture.")
@@ -870,6 +870,7 @@ Use -march to specify the architecture.")
870870
message(FATAL_ERROR "\
871871
Hard-float library with target triple \"${target_triple}\" must end \"-eabihf\"")
872872
endif()
873+
string(REPLACE "-none-" "-none-unknown-" normalized_target_triple ${target_triple})
873874

874875
get_runtimes_flags("${directory}" "${flags}")
875876

@@ -930,7 +931,7 @@ Hard-float library with target triple \"${target_triple}\" must end \"-eabihf\""
930931
COMMAND
931932
${CMAKE_COMMAND}
932933
-E copy_directory
933-
<INSTALL_DIR>/lib/${target_triple}
934+
<INSTALL_DIR>/lib/${normalized_target_triple}
934935
"${LLVM_BINARY_DIR}/${directory}/lib"
935936
)
936937

@@ -1081,7 +1082,7 @@ endfunction()
10811082

10821083
function(get_compiler_rt_target_triple target_arch flags)
10831084
if(target_arch STREQUAL "aarch64")
1084-
set(target_triple "aarch64-none-unknown-elf")
1085+
set(target_triple "aarch64-none-elf")
10851086
else()
10861087
# Choose the target triple so that compiler-rt will do the
10871088
# right thing. We can't always put the exact target
@@ -1093,9 +1094,9 @@ function(get_compiler_rt_target_triple target_arch flags)
10931094
# see in the triple because that's where it looks to decide whether to
10941095
# use specific assembly sources.
10951096
if(target_arch MATCHES "^armv[4-6]")
1096-
set(target_triple "${target_arch}-none-unknown-eabi")
1097+
set(target_triple "${target_arch}-none-eabi")
10971098
else()
1098-
set(target_triple "arm-none-unknown-eabi")
1099+
set(target_triple "arm-none-eabi")
10991100
endif()
11001101
if(flags MATCHES "-mfloat-abi=hard")
11011102
# Also, compiler-rt looks in the ABI component of the

0 commit comments

Comments
 (0)