[compiler-rt] CompilerRT: Normalize COMPILER_RT_DEFAULT_TARGET_TRIPLE (PR #88835)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 18 03:24:15 PDT 2024
mstorsjo wrote:
As this is a reland of an old patch, it would be good to link explicitly to the previously relanded commit or PR, or even the commit where the previous one was reverted - as things stand right now, it's not easy to go from this PR review to the previous one.
Anyway, this patch did break my build... I agree with the idea of this patch, but `-print-effective-triple` doesn't seem to work exactly as it should for my targets.
When building compiler-rt builtins for the `armv7-w64-windows-gnu` target, `-print-effective-triple` prints `thumbv7-w64-windows-gnu`. This is correct (this is an arm target, but one where we always generate code in thumb mode), but unexpected for most of the ecosystem. In practice, this doesn't build any builtins at all for this target.
We can patch around that by with the following patch:
```diff
diff --git a/compiler-rt/cmake/builtin-config-ix.cmake b/compiler-rt/cmake/builtin-config-ix.cmake
index 33c97b1ac28a..cf02f47e4c1e 100644
--- a/compiler-rt/cmake/builtin-config-ix.cmake
+++ b/compiler-rt/cmake/builtin-config-ix.cmake
@@ -53,7 +53,7 @@ else()
endif()
set(ARM64 aarch64)
-set(ARM32 arm armhf armv4t armv5te armv6 armv6m armv7m armv7em armv7 armv7s armv7k armv8m.base armv8m.main armv8.1m.main)
+set(ARM32 arm armhf armv4t armv5te armv6 armv6m armv7m armv7em armv7 armv7s armv7k armv8m.base armv8m.main armv8.1m.main thumbv7)
set(AVR avr)
set(HEXAGON hexagon)
set(X86 i386)
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index f9611574a562..e94912103755 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -615,6 +615,7 @@ set(armhf_SOURCES ${arm_SOURCES})
set(armv7_SOURCES ${arm_SOURCES})
set(armv7s_SOURCES ${arm_SOURCES})
set(armv7k_SOURCES ${arm_SOURCES})
+set(thumbv7_SOURCES ${arm_SOURCES})
set(arm64_SOURCES ${aarch64_SOURCES})
set(arm64e_SOURCES ${aarch64_SOURCES})
set(arm64_32_SOURCES ${aarch64_SOURCES})
```
However, for the purposes of this patch, getting the right normalized triple for the output of the build so clang will find it, this target also behaves weirdly:
```console
$ clang --target=armv7-w64-windows-gnu -print-effective-triple
thumbv7-w64-windows-gnu
$ clang --target=armv7-w64-windows-gnu -print-runtime-dir
<prefix>/lib/clang/19/lib/armv7-w64-windows-gnu
```
So for this target, the output of `-print-effective-triple` will place the output in a directory different from the one where clang actually will look.
So I'd go ahead and revert this for now, so we can unbreak my continous builds at e.g. https://github.com/mstorsjo/llvm-mingw/actions/runs/8730621159 that were broken by this.
https://github.com/llvm/llvm-project/pull/88835
More information about the llvm-commits
mailing list