[compiler-rt] 16f1887 - CompilerRT: Normalize COMPILER_RT_DEFAULT_TARGET_TRIPLE (#88835)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 23:23:40 PDT 2024
Author: YunQiang Su
Date: 2024-04-17T14:23:37+08:00
New Revision: 16f188761da1df6ba5e6627b8742aacfec8e9ec5
URL: https://github.com/llvm/llvm-project/commit/16f188761da1df6ba5e6627b8742aacfec8e9ec5
DIFF: https://github.com/llvm/llvm-project/commit/16f188761da1df6ba5e6627b8742aacfec8e9ec5.diff
LOG: 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>.
Added:
Modified:
compiler-rt/cmake/Modules/CompilerRTUtils.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index e8e5f612d5b03c..6d413f6753bc0c 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -368,6 +368,12 @@ macro(construct_compiler_rt_default_triple)
"Default triple for which compiler-rt runtimes will be built.")
endif()
+ if ("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
+ execute_process(COMMAND ${CMAKE_C_COMPILER} --target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE} -print-effective-triple
+ OUTPUT_VARIABLE COMPILER_RT_DEFAULT_TARGET_TRIPLE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+
string(REPLACE "-" ";" LLVM_TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
list(GET LLVM_TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH)
More information about the llvm-commits
mailing list