Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 32-bit big-endian PowerPC support #1676

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ jobs:
target:
- aarch64-unknown-linux-musl
- i686-pc-windows-msvc
- powerpc-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- s390x-unknown-linux-gnu
- x86_64-unknown-linux-gnu
Expand All @@ -365,6 +366,9 @@ jobs:
- target: i686-pc-windows-msvc
host_os: windows-latest

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

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

Expand Down Expand Up @@ -502,12 +506,15 @@ jobs:

# TODO: targets
target:
- aarch64-unknown-linux-gnu
- i686-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu # Has assembly
- i686-unknown-linux-gnu # Has assembly
# TODO: arm-unknown-linux-gnueabi # Has assembly but doesn't build w/ clang
# TODO: armv7-unknown-linux-gnueabihf # Has assembly but doesn't have profiler builtins
# TODO: powerpc-unknown-linux-gnu No assembly 32-bit big-endian but doesn't have profiler builtins
- powerpc64le-unknown-linux-gnu # No assembly 64-bit little-endian with flags
- riscv64gc-unknown-linux-gnu # No assembly 64-bit little-endian without flags
- s390x-unknown-linux-gnu # No assembly 64-bit big-endian
- x86_64-unknown-linux-musl # Has assembly

mode:
- # debug
Expand Down
2 changes: 2 additions & 0 deletions include/ring-core/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#elif defined(__MIPSEL__) && defined(__LP64__)
#define OPENSSL_64_BIT
#define OPENSSL_MIPS64
#elif (defined(__PPC__) || defined(__powerpc__)) && defined(_BIG_ENDIAN)
#define OPENSSL_32_BIT
#elif (defined(__PPC64__) || defined(__powerpc64__)) && defined(_LITTLE_ENDIAN)
#define OPENSSL_64_BIT
#define OPENSSL_PPC64LE
Expand Down
8 changes: 8 additions & 0 deletions mk/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ 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_mipsel="qemu-mipsel -L /usr/mipsel-linux-gnu"
qemu_powerpc="qemu-ppc -L /usr/powerpc-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"
Expand Down Expand Up @@ -102,6 +103,13 @@ case $target in
export CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc
export CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_RUNNER="$qemu_mipsel"
;;
powerpc-unknown-linux-gnu)
export CC_powerpc_unknown_linux_gnu=clang-$llvm_version
export AR_powerpc_unknown_linux_gnu=llvm-ar-$llvm_version
export CFLAGS_powerpc_unknown_linux_gnu="--sysroot=/usr/powerpc-linux-gnu"
export CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc
export CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="$qemu_powerpc"
;;
powerpc64le-unknown-linux-gnu)
export CC_powerpc64le_unknown_linux_gnu=clang-$llvm_version
export AR_powerpc64le_unknown_linux_gnu=llvm-ar-$llvm_version
Expand Down
7 changes: 7 additions & 0 deletions mk/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ case $target in
libc6-dev-mipsel-cross \
qemu-user
;;
--target=powerpc-unknown-linux-gnu)
use_clang=1
install_packages \
gcc-powerpc-linux-gnu \
libc6-dev-powerpc-cross \
qemu-user
;;
--target=powerpc64le-unknown-linux-gnu)
use_clang=1
install_packages \
Expand Down
7 changes: 0 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,3 @@ mod sealed {
// ```
pub trait Sealed {}
}

// XXX: 64-bit big endian is tested; 32-bit is not.
// TODO: Add 32-bit big endian test coverage to CI.
const _ENDIAN_TESTING: () = assert!(cfg!(any(
target_endian = "little",
target_pointer_width = "64"
)));