about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-01 08:53:07 +0200
committerGitHub <noreply@github.com>2024-07-01 08:53:07 +0200
commitc7e64dcbf155b237a1662a6377e6157bfc5bf316 (patch)
treea86307ce5936064f701fd727d5176bda8f49d687
parent6938b4b64059aab458a4fa9585b770d776e04c19 (diff)
parent03fce3648db08c8fdc726408930c276fec5af124 (diff)
downloadrust-c7e64dcbf155b237a1662a6377e6157bfc5bf316.tar.gz
rust-c7e64dcbf155b237a1662a6377e6157bfc5bf316.zip
Rollup merge of #127150 - xen0n:issue125908, r=Kobzol
Fix x86_64 code being produced for bare-metal LoongArch targets' `compiler_builtins`

Formerly the `loongarch*-*-none*` targets were added to the `dist-various-2` CI job, but no corresponding toolchain was added along with them. This meant the `compiler_builtins` for the targets were built with the host toolchain.

As the other `dist-various` toolchains are mostly pre-built so far, to avoid burdening them with crosstool-ng builds, simply move the two bare-metal LoongArch targets to the `dist-loongarch64-linux` job which has a ready-to-use LoongArch toolchain. With the proper CFLAGS applied it is possible to build artifacts suitable for bare-metal. I verified that the `compiler_builtins` objects are now correctly produced regarding architecture and ABI, with the changes here applied.

Fixes #125908.

cc ``@heiher``

try-job: dist-loongarch64-linux
try-job: dist-various-2
-rw-r--r--src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile20
-rw-r--r--src/ci/docker/host-x86_64/dist-various-2/Dockerfile2
2 files changed, 19 insertions, 3 deletions
diff --git a/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile
index 7e35f781b6b..d3956651663 100644
--- a/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-loongarch64-linux/Dockerfile
@@ -23,7 +23,25 @@ ENV CC_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-gcc \
     AR_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-ar \
     CXX_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-g++
 
+# We re-use the Linux toolchain for bare-metal, because upstream bare-metal
+# target support for LoongArch is only available from GCC 14+.
+#
+# See: https://github.com/gcc-mirror/gcc/commit/976f4f9e4770
+ENV CC_loongarch64_unknown_none=loongarch64-unknown-linux-gnu-gcc \
+    AR_loongarch64_unknown_none=loongarch64-unknown-linux-gnu-ar \
+    CXX_loongarch64_unknown_none=loongarch64-unknown-linux-gnu-g++ \
+    CFLAGS_loongarch64_unknown_none="-ffreestanding -mabi=lp64d" \
+    CXXFLAGS_loongarch64_unknown_none="-ffreestanding -mabi=lp64d" \
+    CC_loongarch64_unknown_none_softfloat=loongarch64-unknown-linux-gnu-gcc \
+    AR_loongarch64_unknown_none_softfloat=loongarch64-unknown-linux-gnu-ar \
+    CXX_loongarch64_unknown_none_softfloat=loongarch64-unknown-linux-gnu-g++ \
+    CFLAGS_loongarch64_unknown_none_softfloat="-ffreestanding -mabi=lp64s -mfpu=none" \
+    CXXFLAGS_loongarch64_unknown_none_softfloat="-ffreestanding -mabi=lp64s -mfpu=none"
+
 ENV HOSTS=loongarch64-unknown-linux-gnu
+ENV TARGETS=$HOSTS
+ENV TARGETS=$TARGETS,loongarch64-unknown-none
+ENV TARGETS=$TARGETS,loongarch64-unknown-none-softfloat
 
 ENV RUST_CONFIGURE_ARGS \
       --enable-extended \
@@ -31,4 +49,4 @@ ENV RUST_CONFIGURE_ARGS \
       --enable-profiler \
       --disable-docs
 
-ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
+ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $TARGETS
diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
index bb6254942cb..e3cb396b782 100644
--- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
@@ -121,8 +121,6 @@ ENV TARGETS=$TARGETS,armv7-unknown-linux-gnueabi
 ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabi
 ENV TARGETS=$TARGETS,i686-unknown-freebsd
 ENV TARGETS=$TARGETS,x86_64-unknown-none
-ENV TARGETS=$TARGETS,loongarch64-unknown-none
-ENV TARGETS=$TARGETS,loongarch64-unknown-none-softfloat
 ENV TARGETS=$TARGETS,aarch64-unknown-uefi
 ENV TARGETS=$TARGETS,i686-unknown-uefi
 ENV TARGETS=$TARGETS,x86_64-unknown-uefi