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 MIPS support #1277

Closed
wants to merge 4 commits into from
Closed
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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ jobs:
- i686-pc-windows-msvc
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- mipsel-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- x86_64-apple-darwin
Expand Down Expand Up @@ -259,6 +260,9 @@ jobs:
- target: i686-unknown-linux-musl
host_os: ubuntu-18.04

- target: mipsel-unknown-linux-gnu
host_os: ubuntu-18.04

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

Expand Down
10 changes: 7 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ const RING_SRCS: &[(&[&str], &str)] = &[
(&[], "crypto/limbs/limbs.c"),
(&[], "crypto/mem.c"),
(&[], "crypto/poly1305/poly1305.c"),
(&[], "crypto/curve25519/curve25519.c"),
(&[], "crypto/fipsmodule/ec/ecp_nistz.c"),
(&[], "crypto/fipsmodule/ec/p256.c"),

(&[AARCH64, ARM, X86_64, X86], "crypto/crypto.c"),
(&[AARCH64, ARM, X86_64, X86], "crypto/curve25519/curve25519.c"),
(&[AARCH64, ARM, X86_64, X86], "crypto/fipsmodule/ec/ecp_nistz.c"),
(&[AARCH64, ARM, X86_64, X86], "crypto/fipsmodule/ec/gfp_p256.c"),
(&[AARCH64, ARM, X86_64, X86], "crypto/fipsmodule/ec/gfp_p384.c"),
(&[AARCH64, ARM, X86_64, X86], "crypto/fipsmodule/ec/p256.c"),

(&[X86_64, X86], "crypto/cpu-intel.c"),

Expand Down Expand Up @@ -303,6 +303,10 @@ fn main() {
fn ring_build_rs_main() {
use std::env;

if env::var("CARGO_CFG_TARGET_ENDIAN").unwrap() == "big" {
panic!("Big-endian targets are not supported yet");
}

let out_dir = env::var("OUT_DIR").unwrap();
let out_dir = PathBuf::from(out_dir);

Expand Down
14 changes: 14 additions & 0 deletions mk/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ 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_mipsel="qemu-system-mipsel -L /usr/mipsel-linux-gnu"
qemu_mips64el="qemu-system-mips64el -L /usr/mips64el-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 @@ -87,6 +89,18 @@ case $target in
export AR_i686_unknown_linux_musl=llvm-ar-$llvm_version
export CARGO_TARGET_I686_UNKNOWN_LINUX_MUSL_RUSTFLAGS="$rustflags_self_contained"
;;
mipsel-unknown-linux-gnu)
export CC_mipsel_unknown_linux_gnu=mipsel-linux-gnu-gcc
export AR_mipsel_unknown_linux_gnu=mipsel-linux-gnu-gcc-ar
export CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc
export CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_RUNNER="$qemu_mipsel"
;;
mips64el-unknown-linux-gnuabi64)
export CC_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnu-gcc
export AR_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnu-gcc-ar
export CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-linux-gnu-gcc
export CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_RUNNER="$qemu_mips64el"
;;
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
12 changes: 12 additions & 0 deletions mk/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ case $target in
--target=i686-unknown-linux-musl|--target=x86_64-unknown-linux-musl)
use_clang=1
;;
--target=mipsel-unknown-linux-gnu)
install_packages \
qemu-user \
gcc-mipsel-linux-gnu \
libc6-dev-mipsel-cross
;;
--target=mips64el-unknown-linux-gnu)
install_packages \
qemu-user \
gcc-mips64el-linux-gnu \
libc6-dev-mips64el-cross
;;
--target=wasm32-unknown-unknown)
# The version of wasm-bindgen-cli must match the wasm-bindgen version.
wasm_bindgen_version=$(cargo metadata --format-version 1 | jq -r '.packages | map(select( .name == "wasm-bindgen")) | map(.version) | .[0]')
Expand Down