diff --git a/.travis.yml b/.travis.yml index c76e17a27d188..e68052fc7d976 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,7 +114,7 @@ matrix: - env: IMAGE=armhf-gnu if: branch = auto - env: IMAGE=cross DEPLOY=1 - if: branch = auto + # if: branch = auto - env: IMAGE=cross2 DEPLOY=1 if: branch = auto - env: IMAGE=dist-aarch64-linux DEPLOY=1 diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 42425a164a20e..753f5b603bc4b 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -117,6 +117,8 @@ def v(*args): "armv7-unknown-linux-musleabihf install directory") v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root", "aarch64-unknown-linux-musl install directory") +v("musl-root-ppc", "target.powerpc-unknown-linux-musl.musl-root", + "powerpc-unknown-linux-musl install directory") v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs", "rootfs in qemu testing, you probably don't want to use this") v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs", diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index c37b1dad4c687..c8cefac63af19 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -443,6 +443,7 @@ impl Step for Openssl { "mips64el-unknown-linux-gnuabi64" => "linux64-mips64", "mipsel-unknown-linux-gnu" => "linux-mips32", "powerpc-unknown-linux-gnu" => "linux-ppc", + "powerpc-unknown-linux-musl" => "linux-ppc", "powerpc64-unknown-linux-gnu" => "linux-ppc64", "powerpc64le-unknown-linux-gnu" => "linux-ppc64le", "s390x-unknown-linux-gnu" => "linux64-s390x", diff --git a/src/ci/docker/cross/Dockerfile b/src/ci/docker/cross/Dockerfile index 05745709a07cb..426b56945a9bb 100644 --- a/src/ci/docker/cross/Dockerfile +++ b/src/ci/docker/cross/Dockerfile @@ -15,6 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ g++-arm-linux-gnueabi \ g++-arm-linux-gnueabihf \ g++-aarch64-linux-gnu \ + g++-powerpc-linux-gnu \ gcc-sparc64-linux-gnu \ libc6-dev-sparc64-cross \ bzip2 \ @@ -48,6 +49,7 @@ ENV TARGETS=$TARGETS,arm-unknown-linux-musleabi ENV TARGETS=$TARGETS,arm-unknown-linux-musleabihf ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf ENV TARGETS=$TARGETS,aarch64-unknown-linux-musl +ENV TARGETS=$TARGETS,powerpc-unknown-linux-musl ENV TARGETS=$TARGETS,sparc64-unknown-linux-gnu ENV TARGETS=$TARGETS,x86_64-unknown-redox @@ -65,7 +67,8 @@ ENV RUST_CONFIGURE_ARGS \ --musl-root-arm=/usr/local/arm-linux-musleabi \ --musl-root-armhf=/usr/local/arm-linux-musleabihf \ --musl-root-armv7=/usr/local/armv7-linux-musleabihf \ - --musl-root-aarch64=/usr/local/aarch64-linux-musl + --musl-root-aarch64=/usr/local/aarch64-linux-musl \ + --musl-root-ppc=/usr/local/ppc-linux-musl ENV SCRIPT python2.7 ../x.py dist --target $TARGETS # sccache diff --git a/src/ci/docker/cross/build-arm-musl.sh b/src/ci/docker/cross/build-arm-musl.sh index 780099e2ec176..a30ad979c163d 100755 --- a/src/ci/docker/cross/build-arm-musl.sh +++ b/src/ci/docker/cross/build-arm-musl.sh @@ -77,12 +77,25 @@ CFLAGS="" \ hide_output make -j$(nproc) hide_output make install cd .. +rm -rf musl-$MUSL + +tar xf musl-$MUSL.tar.gz +cd musl-$MUSL +CC=powerpc-linux-gnu-gcc \ +CFLAGS="-mlong-double-64" \ + hide_output ./configure \ + --prefix=/usr/local/ppc-linux-musl \ + --enable-wrapper=gcc +hide_output make -j$(nproc) +hide_output make install +cd .. rm -rf musl-$MUSL* ln -nsf ../arm-linux-musleabi/bin/musl-gcc /usr/local/bin/arm-linux-musleabi-gcc ln -nsf ../arm-linux-musleabihf/bin/musl-gcc /usr/local/bin/arm-linux-musleabihf-gcc ln -nsf ../armv7-linux-musleabihf/bin/musl-gcc /usr/local/bin/armv7-linux-musleabihf-gcc ln -nsf ../aarch64-linux-musl/bin/musl-gcc /usr/local/bin/aarch64-unknown-linux-musl-gcc +ln -nsf ../ppc-linux-musl/bin/musl-gcc /usr/local/bin/powerpc-unknown-linux-musl-gcc curl -L https://github.com/llvm-mirror/llvm/archive/release_39.tar.gz | tar xzf - curl -L https://github.com/llvm-mirror/libunwind/archive/release_39.tar.gz | tar xzf - @@ -143,5 +156,19 @@ cp lib/libunwind.a /usr/local/aarch64-linux-musl/lib cd .. rm -rf libunwind-build +mkdir libunwind-build +cd libunwind-build +cmake ../libunwind-release_39 \ + -DLLVM_PATH=/tmp/llvm-release_39 \ + -DLIBUNWIND_ENABLE_SHARED=0 \ + -DCMAKE_C_COMPILER=powerpc-linux-gnu-gcc \ + -DCMAKE_CXX_COMPILER=powerpc-linux-gnu-g++ \ + -DCMAKE_C_FLAGS="-D__ppc__ -mlong-double-64" \ + -DCMAKE_CXX_FLAGS="-D__ppc__ -mlong-double-64" +make -j$(nproc) +cp lib/libunwind.a /usr/local/ppc-linux-musl/lib +cd .. +rm -rf libunwind-build + rm -rf libunwind-release_39 rm -rf llvm-release_39 diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index a56d067815819..6724d5fee7ef4 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -143,6 +143,7 @@ supported_targets! { ("mips64el-unknown-linux-gnuabi64", mips64el_unknown_linux_gnuabi64), ("mipsel-unknown-linux-gnu", mipsel_unknown_linux_gnu), ("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu), + ("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl), ("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu), ("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu), ("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu), diff --git a/src/librustc_back/target/powerpc_unknown_linux_musl.rs b/src/librustc_back/target/powerpc_unknown_linux_musl.rs new file mode 100644 index 0000000000000..48ca1507403df --- /dev/null +++ b/src/librustc_back/target/powerpc_unknown_linux_musl.rs @@ -0,0 +1,35 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use LinkerFlavor; +use target::{Target, TargetResult}; + +pub fn target() -> TargetResult { + let mut base = super::linux_musl_base::opts(); + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string()); + base.max_atomic_width = Some(32); + + // see #36994 + base.exe_allocation_crate = None; + + Ok(Target { + llvm_target: "powerpc-unknown-linux-musl".to_string(), + target_endian: "big".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(), + arch: "powerpc".to_string(), + target_os: "linux".to_string(), + target_env: "musl".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + options: base, + }) +} diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 8c1b130b11652..ac9f4ab104227 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -79,6 +79,7 @@ static TARGETS: &'static [&'static str] = &[ "mipsel-unknown-linux-gnu", "mipsel-unknown-linux-musl", "powerpc-unknown-linux-gnu", + "powerpc-unknown-linux-musl", "powerpc64-unknown-linux-gnu", "powerpc64le-unknown-linux-gnu", "s390x-unknown-linux-gnu",