Skip to content

Commit d3925e6

Browse files
authored
CompilerRT: Normalize COMPILER_RT_DEFAULT_TARGET_TRIPLE (#89234)
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>. `libcxx/utils/ci/run-buildbot` is also updated to use `armv7m-none-unknown-eabi` as normalized triple instead of current `armv7m-none-eabi`. ChangeLog of this PR: This patch has been applied and revert twice: 1. The first try is #88407, and then it is found that it causes some CI failures. https://lab.llvm.org/buildbot/#/builders/98/builds/36366 It is then resolved by another commit: 1693009 https://lab.llvm.org/buildbot/#/builders/77/builds/36372 It is caused that `COMPILER_RT_DEFAULT_TARGET_TRIPLE` is overwrite without taking care about `CACHE`. 2. The second try #88835, resolves https://lab.llvm.org/buildbot/#/builders/77/builds/36372 and in fact only one `execute_process` is needed. Then we find some other CI failures. https://github.com/mstorsjo/llvm-mingw/actions/runs/8730621159 https://buildkite.com/llvm-project/libcxx-ci/builds/34897#018eec06-612c-47f1-9931-d3bd88bf7ced It is due to misunderstanding `-print-effective-triple`: which will output `thumbv7-w64-windows-gnu` for `armv7-w64-windows-gnu` or some other thumb-enabled arm triples. In fact we should use `-print-target-triple`. For armv7m-picolibc, `armv7m-none-eabi` is hardcoded in libcxx/utils/ci/run-buildbot, while in fact `armv7m-none-unknown-eabi` is the real normalized triple.
1 parent de3e4a9 commit d3925e6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

compiler-rt/cmake/Modules/CompilerRTUtils.cmake

Lines changed: 6 additions & 0 deletions
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-target-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

libcxx/utils/ci/run-buildbot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function test-armv7m-picolibc() {
217217
"${@}"
218218

219219
${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
220-
mv "${BUILD_DIR}/install/lib/armv7m-none-eabi"/* "${BUILD_DIR}/install/lib"
220+
mv "${BUILD_DIR}/install/lib/armv7m-none-unknown-eabi"/* "${BUILD_DIR}/install/lib"
221221

222222
check-runtimes
223223
}

0 commit comments

Comments
 (0)