Skip to content

Commit 39cc53a

Browse files
committed
add powerpc-unknown-linux-musl target
1 parent b633341 commit 39cc53a

File tree

7 files changed

+71
-1
lines changed

7 files changed

+71
-1
lines changed

src/bootstrap/configure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def v(*args):
117117
"armv7-unknown-linux-musleabihf install directory")
118118
v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
119119
"aarch64-unknown-linux-musl install directory")
120+
v("musl-root-ppc", "target.powerpc-unknown-linux-musl.musl-root",
121+
"powerpc-unknown-linux-musl install directory")
120122
v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs",
121123
"rootfs in qemu testing, you probably don't want to use this")
122124
v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",

src/bootstrap/native.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ impl Step for Openssl {
443443
"mips64el-unknown-linux-gnuabi64" => "linux64-mips64",
444444
"mipsel-unknown-linux-gnu" => "linux-mips32",
445445
"powerpc-unknown-linux-gnu" => "linux-ppc",
446+
"powerpc-unknown-linux-musl" => "linux-ppc",
446447
"powerpc64-unknown-linux-gnu" => "linux-ppc64",
447448
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
448449
"s390x-unknown-linux-gnu" => "linux64-s390x",

src/ci/docker/cross/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
g++-arm-linux-gnueabi \
1616
g++-arm-linux-gnueabihf \
1717
g++-aarch64-linux-gnu \
18+
g++-powerpc-linux-gnu \
1819
gcc-sparc64-linux-gnu \
1920
libc6-dev-sparc64-cross \
2021
bzip2 \
@@ -48,6 +49,7 @@ ENV TARGETS=$TARGETS,arm-unknown-linux-musleabi
4849
ENV TARGETS=$TARGETS,arm-unknown-linux-musleabihf
4950
ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabihf
5051
ENV TARGETS=$TARGETS,aarch64-unknown-linux-musl
52+
ENV TARGETS=$TARGETS,powerpc-unknown-linux-musl
5153
ENV TARGETS=$TARGETS,sparc64-unknown-linux-gnu
5254
ENV TARGETS=$TARGETS,x86_64-unknown-redox
5355

@@ -65,7 +67,8 @@ ENV RUST_CONFIGURE_ARGS \
6567
--musl-root-arm=/usr/local/arm-linux-musleabi \
6668
--musl-root-armhf=/usr/local/arm-linux-musleabihf \
6769
--musl-root-armv7=/usr/local/armv7-linux-musleabihf \
68-
--musl-root-aarch64=/usr/local/aarch64-linux-musl
70+
--musl-root-aarch64=/usr/local/aarch64-linux-musl \
71+
--musl-root-ppc=/usr/local/ppc-linux-musl
6972
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
7073

7174
# sccache

src/ci/docker/cross/build-arm-musl.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,25 @@ CFLAGS="" \
7777
hide_output make -j$(nproc)
7878
hide_output make install
7979
cd ..
80+
rm -rf musl-$MUSL
81+
82+
tar xf musl-$MUSL.tar.gz
83+
cd musl-$MUSL
84+
CC=powerpc-linux-gnu-gcc \
85+
CFLAGS="" \
86+
hide_output ./configure \
87+
--prefix=/usr/local/ppc-linux-musl \
88+
--enable-wrapper=gcc
89+
hide_output make -j$(nproc)
90+
hide_output make install
91+
cd ..
8092
rm -rf musl-$MUSL*
8193

8294
ln -nsf ../arm-linux-musleabi/bin/musl-gcc /usr/local/bin/arm-linux-musleabi-gcc
8395
ln -nsf ../arm-linux-musleabihf/bin/musl-gcc /usr/local/bin/arm-linux-musleabihf-gcc
8496
ln -nsf ../armv7-linux-musleabihf/bin/musl-gcc /usr/local/bin/armv7-linux-musleabihf-gcc
8597
ln -nsf ../aarch64-linux-musl/bin/musl-gcc /usr/local/bin/aarch64-unknown-linux-musl-gcc
98+
ln -nsf ../ppc-linux-musl/bin/musl-gcc /usr/local/bin/powerpc-unknown-linux-musl-gcc
8699

87100
curl -L https://github.com/llvm-mirror/llvm/archive/release_39.tar.gz | tar xzf -
88101
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
143156
cd ..
144157
rm -rf libunwind-build
145158

159+
mkdir libunwind-build
160+
cd libunwind-build
161+
cmake ../libunwind-release_39 \
162+
-DLLVM_PATH=/tmp/llvm-release_39 \
163+
-DLIBUNWIND_ENABLE_SHARED=0 \
164+
-DCMAKE_C_COMPILER=powerpc-linux-gnu-gcc \
165+
-DCMAKE_CXX_COMPILER=powerpc-linux-gnu-g++ \
166+
-DCMAKE_C_FLAGS="" \
167+
-DCMAKE_CXX_FLAGS=""
168+
make -j$(nproc)
169+
cp lib/libunwind.a /usr/local/ppc-linux-musl/lib
170+
cd ..
171+
rm -rf libunwind-build
172+
146173
rm -rf libunwind-release_39
147174
rm -rf llvm-release_39

src/librustc_back/target/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ supported_targets! {
143143
("mips64el-unknown-linux-gnuabi64", mips64el_unknown_linux_gnuabi64),
144144
("mipsel-unknown-linux-gnu", mipsel_unknown_linux_gnu),
145145
("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
146+
("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl),
146147
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
147148
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
148149
("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu),
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use LinkerFlavor;
12+
use target::{Target, TargetResult};
13+
14+
pub fn target() -> TargetResult {
15+
let mut base = super::linux_musl_base::opts();
16+
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
17+
base.max_atomic_width = Some(32);
18+
19+
// see #36994
20+
base.exe_allocation_crate = None;
21+
22+
Ok(Target {
23+
llvm_target: "powerpc-unknown-linux-musl".to_string(),
24+
target_endian: "big".to_string(),
25+
target_pointer_width: "32".to_string(),
26+
target_c_int_width: "32".to_string(),
27+
data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(),
28+
arch: "powerpc".to_string(),
29+
target_os: "linux".to_string(),
30+
target_env: "musl".to_string(),
31+
target_vendor: "unknown".to_string(),
32+
linker_flavor: LinkerFlavor::Gcc,
33+
options: base,
34+
})
35+
}

src/tools/build-manifest/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static TARGETS: &'static [&'static str] = &[
7979
"mipsel-unknown-linux-gnu",
8080
"mipsel-unknown-linux-musl",
8181
"powerpc-unknown-linux-gnu",
82+
"powerpc-unknown-linux-musl",
8283
"powerpc64-unknown-linux-gnu",
8384
"powerpc64le-unknown-linux-gnu",
8485
"s390x-unknown-linux-gnu",

0 commit comments

Comments
 (0)