Skip to content

Commit

Permalink
Basic support for s390x target
Browse files Browse the repository at this point in the history
  • Loading branch information
uweigand committed Oct 1, 2023
1 parent 20e1493 commit 3062477
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ jobs:
- i686-unknown-linux-musl
- powerpc64le-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
Expand Down Expand Up @@ -255,6 +256,9 @@ jobs:
- target: riscv64gc-unknown-linux-gnu
host_os: ubuntu-22.04

- target: s390x-unknown-linux-gnu
host_os: ubuntu-22.04

- target: x86_64-pc-windows-gnu
host_os: windows-latest

Expand Down Expand Up @@ -342,6 +346,7 @@ jobs:
- aarch64-unknown-linux-musl
- i686-pc-windows-msvc
- powerpc64le-unknown-linux-gnu
- s390x-unknown-linux-gnu
- x86_64-unknown-linux-gnu

mode:
Expand All @@ -363,6 +368,9 @@ jobs:
- target: powerpc64le-unknown-linux-gnu
host_os: ubuntu-22.04

- target: s390x-unknown-linux-gnu
host_os: ubuntu-22.04

- target: x86_64-unknown-linux-gnu
host_os: ubuntu-22.04

Expand Down Expand Up @@ -498,6 +506,7 @@ jobs:
- i686-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
- x86_64-unknown-linux-musl

mode:
Expand Down Expand Up @@ -527,6 +536,9 @@ jobs:
- target: riscv64gc-unknown-linux-gnu
host_os: ubuntu-22.04

- target: s390x-unknown-linux-gnu
host_os: ubuntu-22.04

- target: x86_64-unknown-linux-musl
host_os: ubuntu-22.04

Expand Down
3 changes: 3 additions & 0 deletions include/ring-core/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
#elif defined(__riscv) && __SIZEOF_POINTER__ == 8
#define OPENSSL_64_BIT
#define OPENSSL_RISCV64
#elif defined(__s390x__)
#define OPENSSL_64_BIT
#define OPENSSL_S390X
#elif defined(__wasm__)
#define OPENSSL_32_BIT
#else
Expand Down
11 changes: 11 additions & 0 deletions mk/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ qemu_arm="qemu-arm -L /usr/arm-linux-gnueabihf"
qemu_mipsel="qemu-mipsel -L /usr/mipsel-linux-gnu"
qemu_powerpc64le="qemu-ppc64le -L /usr/powerpc64le-linux-gnu"
qemu_riscv64="qemu-riscv64 -L /usr/riscv64-linux-gnu"
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
Expand Down Expand Up @@ -114,6 +115,16 @@ case $target in
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=riscv64-linux-gnu-gcc
export CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_RUNNER="$qemu_riscv64"
;;
s390x-unknown-linux-gnu)
export CC_s390x_unknown_linux_gnu=clang-$llvm_version
export AR_s390x_unknown_linux_gnu=llvm-ar-$llvm_version
# XXX: Using -march=zEC12 to work around a z13 instruction bug in
# QEMU 8.0.2 and earlier that causes `test_constant_time` to fail
# (https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg06965.html).
export CFLAGS_s390x_unknown_linux_gnu="--sysroot=/usr/s390x-linux-gnu -march=zEC12"
export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc
export CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="$qemu_s390x"
;;
x86_64-unknown-linux-musl)
export CC_x86_64_unknown_linux_musl=clang-$llvm_version
export AR_x86_64_unknown_linux_musl=llvm-ar-$llvm_version
Expand Down
8 changes: 8 additions & 0 deletions mk/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ case $target in
libc6-dev-riscv64-cross \
qemu-user
;;
--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
Expand Down

0 comments on commit 3062477

Please sign in to comment.