diff --git a/README.md b/README.md index 289971889..4eb2985ee 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,7 @@ terminate. | `aarch64-unknown-linux-gnu` | 2.31 | 9.4.0 | ✓ | 6.1.0 | ✓ | | `aarch64-unknown-linux-gnu:centos` [7] | 2.17 | 4.8.5 | | 4.2.1 | ✓ | | `aarch64-unknown-linux-musl` | 1.2.3 | 9.2.0 | ✓ | 6.1.0 | ✓ | +| `aarch64_be-unknown-linux-gnu` | 2.36 | 14.2.0 | ✓ | 6.1.0 | ✓ | | `arm-linux-androideabi` [1] | 9.0.8 | 9.0.8 | ✓ | 6.1.0 | ✓ | | `arm-unknown-linux-gnueabi` | 2.31 | 9.4.0 | ✓ | 6.1.0 | ✓ | | `arm-unknown-linux-gnueabihf` | 2.31 | 8.5.0 | ✓ | 6.1.0 | ✓ | diff --git a/docker/Dockerfile.aarch64_be-unknown-linux-gnu b/docker/Dockerfile.aarch64_be-unknown-linux-gnu new file mode 100644 index 000000000..822b0f002 --- /dev/null +++ b/docker/Dockerfile.aarch64_be-unknown-linux-gnu @@ -0,0 +1,42 @@ +FROM ubuntu:24.04 AS cross-base +ENV DEBIAN_FRONTEND=noninteractive + +COPY common.sh lib.sh / +RUN /common.sh + +COPY cmake.sh / +RUN /cmake.sh + +FROM cross-base AS build + +ARG VERBOSE +COPY crosstool-ng.sh / +COPY crosstool-config/aarch64_be-unknown-linux-gnu.config / +RUN /crosstool-ng.sh aarch64_be-unknown-linux-gnu.config 5 + +ENV PATH=/x-tools/aarch64_be-unknown-linux-gnu/bin/:$PATH + +COPY qemu.sh / +RUN /qemu.sh aarch64_be + +COPY qemu-runner base-runner.sh / +COPY toolchain.cmake /opt/toolchain.cmake + +ENV CROSS_TOOLCHAIN_PREFIX=aarch64_be-unknown-linux-gnu- +ENV CROSS_SYSROOT=/x-tools/aarch64_be-unknown-linux-gnu/aarch64_be-unknown-linux-gnu/sysroot/ +ENV CROSS_TARGET_RUNNER="/qemu-runner aarch64_be" +ENV CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \ + CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_RUNNER="$CROSS_TARGET_RUNNER" \ + AR_aarch64_be_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"ar \ + CC_aarch64_be_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"gcc \ + CXX_aarch64_be_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"g++ \ + CMAKE_TOOLCHAIN_FILE_aarch64_be_unknown_linux_gnu=/opt/toolchain.cmake \ + BINDGEN_EXTRA_CLANG_ARGS_aarch64_be_unknown_linux_gnu="--sysroot=$CROSS_SYSROOT -idirafter/usr/include" \ + QEMU_LD_PREFIX="$CROSS_SYSROOT" \ + RUST_TEST_THREADS=1 \ + CROSS_CMAKE_SYSTEM_NAME=Linux \ + CROSS_CMAKE_SYSTEM_PROCESSOR=aarch64_be \ + CROSS_CMAKE_CRT=gnu \ + CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC" + +RUN sed -e "s#@DEFAULT_QEMU_LD_PREFIX@#$QEMU_LD_PREFIX#g" -i /qemu-runner diff --git a/docker/crosstool-config/aarch64_be-unknown-linux-gnu.config b/docker/crosstool-config/aarch64_be-unknown-linux-gnu.config new file mode 100644 index 000000000..d21e8169d --- /dev/null +++ b/docker/crosstool-config/aarch64_be-unknown-linux-gnu.config @@ -0,0 +1,38 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_DOWNLOAD_AGENT_CURL=y +CT_ARCH_ARM=y +CT_ARCH_64=y +CT_ARCH_BE=y +CT_ARCH_FLOAT_HW=y +CT_KERNEL_LINUX=y +CT_LINUX_V_5_19=y +# CT_LINUX_NO_VERSIONS is not set +CT_LINUX_VERSION="5.19.16" +CT_LINUX_later_than_4_8=y +CT_LINUX_4_8_or_later=y +CT_LINUX_later_than_3_7=y +CT_LINUX_3_7_or_later=y +CT_LINUX_later_than_3_2=y +CT_LINUX_3_2_or_later=y +CT_GLIBC_V_2_36=y +# CT_GLIBC_NO_VERSIONS is not set +CT_GLIBC_VERSION="2.36" +CT_GLIBC_2_17_or_later=y +CT_GLIBC_later_than_2_14=y +CT_GLIBC_2_14_or_later=y +CT_GCC_V_14=y +# CT_GCC_NO_VERSIONS is not set +CT_GCC_VERSION="14.2.0" +CT_GCC_later_than_7=y +CT_GCC_7_or_later=y +CT_GCC_later_than_6=y +CT_GCC_6_or_later=y +CT_GCC_later_than_5=y +CT_GCC_5_or_later=y +CT_GCC_later_than_4_9=y +CT_GCC_4_9_or_later=y +CT_GCC_later_than_4_8=y +CT_GCC_4_8_or_later=y +CT_CC_LANG_CXX=y + diff --git a/docker/crosstool-ng.sh b/docker/crosstool-ng.sh index f0483ed7b..3ce46e916 100755 --- a/docker/crosstool-ng.sh +++ b/docker/crosstool-ng.sh @@ -27,8 +27,11 @@ main() { local sleep=15s local timeout=5m - install_packages autoconf \ + install_packages \ + adduser \ + autoconf \ bison \ + bzip2 \ curl \ flex \ gawk \ diff --git a/docker/linux-runner b/docker/linux-runner index c0de2ef8c..c483dbcc0 100755 --- a/docker/linux-runner +++ b/docker/linux-runner @@ -53,7 +53,7 @@ drivernet="virtio-net-pci" # select qemu parameters case "${arch}" in - aarch64) + aarch64|aarch64_be) # 8 is the max number of cpu supported by qemu-aarch64 n=$(( n > 8 ? 8 : n )) opt="-machine virt -cpu cortex-a57" diff --git a/src/docker/provided_images.rs b/src/docker/provided_images.rs index cafc5ff90..85121d828 100644 --- a/src/docker/provided_images.rs +++ b/src/docker/provided_images.rs @@ -23,6 +23,11 @@ pub static PROVIDED_IMAGES: &[ProvidedImage] = &[ platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU], sub: None }, + ProvidedImage { + name: "aarch64_be-unknown-linux-gnu", + platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU], + sub: None + }, ProvidedImage { name: "arm-unknown-linux-gnueabi", platforms: &[ImagePlatform::X86_64_UNKNOWN_LINUX_GNU], diff --git a/targets.toml b/targets.toml index 1149f42a4..902985038 100644 --- a/targets.toml +++ b/targets.toml @@ -54,6 +54,16 @@ std = true run = true runners = "qemu-user qemu-system" +[[target]] +target = "aarch64_be-unknown-linux-gnu" +os = "ubuntu-latest" +cpp = true +dylib = true +std = true +run = true +runners = "qemu-user" +build-std = true + [[target]] target = "arm-unknown-linux-gnueabi" os = "ubuntu-latest"