Skip to content

Commit 16f1887

Browse files
authored
CompilerRT: Normalize COMPILER_RT_DEFAULT_TARGET_TRIPLE (#88835)
If LLVM is configured with -DLLVM_DEFAULT_TARGET_TRIPLE, or compiler_rt is configured with -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE, while the argument is not normalized, such as Debian-style vendor-less triple, clang will try to find libclang_rt in lib/<normalized_triple>, while libclang_rt is placed into lib/<triple_arg>. Let's also place libclang_rt into lib/<normalized_triple>.
1 parent 64c6495 commit 16f1887

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler-rt/cmake/Modules/CompilerRTUtils.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,12 @@ macro(construct_compiler_rt_default_triple)
368368
"Default triple for which compiler-rt runtimes will be built.")
369369
endif()
370370

371+
if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
372+
execute_process(COMMAND ${CMAKE_C_COMPILER} --target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} -print-effective-triple
373+
OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE
374+
OUTPUT_STRIP_TRAILING_WHITESPACE)
375+
endif()
376+
371377
string(REPLACE "-" ";" LLVM_TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
372378
list(GET LLVM_TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH)
373379

0 commit comments

Comments
 (0)