From 8c0ead1f358ce259eedeb87ad49b0c7c8bb50d27 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 10 Nov 2022 14:23:58 +0100 Subject: [PATCH] Basic support for s390x target --- include/ring-core/base.h | 3 +++ mk/cargo.sh | 8 ++++++++ mk/install-build-tools.sh | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/include/ring-core/base.h b/include/ring-core/base.h index f1a027d1a4..69cf40ca20 100644 --- a/include/ring-core/base.h +++ b/include/ring-core/base.h @@ -89,6 +89,9 @@ #elif defined(__MIPSEL__) && defined(__LP64__) #define OPENSSL_64_BIT #define OPENSSL_MIPS64 +#elif defined(__s390x__) +#define OPENSSL_64_BIT +#define OPENSSL_S390X #elif defined(__wasm__) #define OPENSSL_32_BIT #else diff --git a/mk/cargo.sh b/mk/cargo.sh index 08c42d5d6c..d55111c2b5 100755 --- a/mk/cargo.sh +++ b/mk/cargo.sh @@ -20,6 +20,7 @@ IFS=$'\n\t' rustflags_self_contained="-Clink-self-contained=yes -Clinker=rust-lld" qemu_aarch64="qemu-aarch64 -L /usr/aarch64-linux-gnu" qemu_arm="qemu-arm -L /usr/arm-linux-gnueabihf" +qemu_s390x="qemu-s390x -L /usr/s390x-linux-gnu" # Avoid putting the Android tools in `$PATH` because there are tools in this # directory like `clang` that would conflict with the same-named tools that may @@ -101,6 +102,13 @@ case $target in export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="$rustflags_self_contained" fi ;; + s390x-unknown-linux-gnu) + export CC_s390x_unknown_linux_gnu=clang-$llvm_version + export AR_s390x_unknown_linux_gnu=llvm-ar-$llvm_version + export CFLAGS_s390x_unknown_linux_gnu="--sysroot=/usr/s390x-linux-gnu" + export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc + export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="$qemu_s390x" + ;; wasm32-unknown-unknown) # The first two are only needed for when the "wasm_c" feature is enabled. export CC_wasm32_unknown_unknown=clang-$llvm_version diff --git a/mk/install-build-tools.sh b/mk/install-build-tools.sh index 1475bc4529..bb0769c39a 100755 --- a/mk/install-build-tools.sh +++ b/mk/install-build-tools.sh @@ -72,6 +72,14 @@ case $target in --target=i686-unknown-linux-musl|--target=x86_64-unknown-linux-musl) use_clang=1 ;; +--target=s390x-unknown-linux-gnu) + # Clang is needed for code coverage. + use_clang=1 + install_packages \ + qemu-user \ + gcc-s390x-linux-gnu \ + libc6-dev-s390x-cross + ;; --target=wasm32-unknown-unknown) cargo install wasm-bindgen-cli --bin wasm-bindgen-test-runner use_clang=1