[libcxx-commits] [libcxx] [libcxx][ci] In picolib build, ask clang for the normalised triple (PR #90722)

David Spickett via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 1 07:08:23 PDT 2024


https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/90722

>From 1bd23a6aa2598361cd721f00470ea68fb4e9d84b Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Wed, 1 May 2024 10:49:21 +0000
Subject: [PATCH 1/2] [libcxx][ci] In picolib build, ask clang for the
 normalised triple

This is needed for a workaround to make sure the link later succeeds.
I don't know the reason for that but it is definitely needed.

https://github.com/llvm/llvm-project/pull/89234 will/wants to correct
the triple normalisation for -none- and this means that clang prior
to 19, and clang 19 and above will have different answers and therefore
different library paths.

I don't want to bootstrap a clang just for libcxx CI, or require that
anyone building for Arm do the same, so ask the compiler what the triple
should be.

This will be compatible with 17 and 19 when we do update to that
version.

I'm assuming $CC is what anyone locally would set to override the
compiler, and `cc` is the binary name in our CI containers. It's not
perfect but it should cover most use cases.
---
 libcxx/utils/ci/run-buildbot | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 60307a7d4f350a..132c98486de430 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -217,7 +217,19 @@ function test-armv7m-picolibc() {
         "${@}"
 
     ${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
-    mv "${BUILD_DIR}/install/lib/armv7m-none-unknown-eabi"/* "${BUILD_DIR}/install/lib"
+
+    # Prior to clang 19, armv7m-none-eabi normalised to armv7m-none-unknown-eabi.
+    # clang 19 changed this to armv7m-unknown-none-eabi. So for as long as 18.x
+    # is supported, we have to ask clang what the triple will be.
+    if [ ! -z "${CC}" ]
+    then
+        C_COMPILER=${CC};
+    else
+        C_COMPILER=cc;
+    fi
+    NORMALISED_TARGET_TRIPLE=$(${C_COMPILER} --target=armv7m-none-eabi -print-target-triple)
+    # Without this step linking fails later in the build.
+    mv "${BUILD_DIR}/install/lib/${NORMALISED_TARGET_TRIPLE}"/* "${BUILD_DIR}/install/lib"
 
     check-runtimes
 }

>From 5236dbe301cc286be7333212ea71a4ddfcf98d18 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Wed, 1 May 2024 14:04:33 +0000
Subject: [PATCH 2/2] better bash use

---
 libcxx/utils/ci/run-buildbot | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 132c98486de430..e40c2b635ef908 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -221,13 +221,7 @@ function test-armv7m-picolibc() {
     # Prior to clang 19, armv7m-none-eabi normalised to armv7m-none-unknown-eabi.
     # clang 19 changed this to armv7m-unknown-none-eabi. So for as long as 18.x
     # is supported, we have to ask clang what the triple will be.
-    if [ ! -z "${CC}" ]
-    then
-        C_COMPILER=${CC};
-    else
-        C_COMPILER=cc;
-    fi
-    NORMALISED_TARGET_TRIPLE=$(${C_COMPILER} --target=armv7m-none-eabi -print-target-triple)
+    NORMALISED_TARGET_TRIPLE=$(${CC-cc} --target=armv7m-none-eabi -print-target-triple)
     # Without this step linking fails later in the build.
     mv "${BUILD_DIR}/install/lib/${NORMALISED_TARGET_TRIPLE}"/* "${BUILD_DIR}/install/lib"
 



More information about the libcxx-commits mailing list