Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.

Commit b57086c

Browse files
committed
Add custom toolchains for powerpc* and s390x
Using Ubuntu's cross-toolchains meant these targets were depending on glibc symbols from Ubuntu 16.04. And if that host is ever updated to a new release, the toolchains would raise the bar too. This switches powerpc* and s390x to use crosstool-ng toolchains, with the kernel and glibc configured approximately like RHEL7. That should also be compatible with Debian 8 (jessie) and Ubuntu 14.04 (trusty).
1 parent 1d3d08a commit b57086c

6 files changed

+2138
-6
lines changed

slaves/linux-cross/Dockerfile

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ RUN apt-get install -y --force-yes --no-install-recommends \
77
zlib1g-dev \
88
bzip2 xz-utils \
99
g++ libc6-dev \
10-
g++-powerpc-linux-gnu libc6-dev-powerpc-cross \
11-
g++-5-powerpc64-linux-gnu libc6-dev-ppc64-powerpc-cross \
12-
g++-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \
13-
g++-s390x-linux-gnu \
1410
bsdtar \
1511
cmake \
1612
g++-5-mips-linux-gnu libc6-dev-mips-cross \
@@ -60,6 +56,10 @@ COPY linux-cross/build_toolchain.sh \
6056
linux-cross/mipsel-linux-musl.config \
6157
linux-cross/armv7-linux-gnueabihf.config \
6258
linux-cross/armv7-linux-musleabihf.config \
59+
linux-cross/powerpc-linux-gnu.config \
60+
linux-cross/powerpc64-linux-gnu.config \
61+
linux-cross/powerpc64le-linux-gnu.config \
62+
linux-cross/s390x-linux-gnu.config \
6363
/build/
6464
USER rustbuild
6565

@@ -108,11 +108,19 @@ RUN /bin/bash build_toolchain.sh arm-linux-musleabi
108108
RUN /bin/bash build_toolchain.sh arm-linux-musleabihf
109109
RUN /bin/bash build_toolchain.sh armv7-linux-musleabihf
110110

111+
# Also build toolchains for {powerpc{,64{,le}},s390x}-unknown-linux-gnu,
112+
# primarily to support older glibc than found in the Ubuntu root.
113+
RUN /bin/bash build_toolchain.sh powerpc-linux-gnu
114+
RUN /bin/bash build_toolchain.sh powerpc64-linux-gnu
115+
RUN /bin/bash build_toolchain.sh powerpc64le-linux-gnu
116+
RUN /bin/bash build_toolchain.sh s390x-linux-gnu
117+
111118
USER root
112119

113120
# Rename all the compilers we just built into /usr/bin and also without
114121
# `-unknown-` in the name because it appears lots of other compilers in Ubuntu
115122
# don't have this name in the component by default either.
123+
# Also rename `-ibm-` out of the s390x compilers.
116124
# Also the aarch64 compiler is prefixed with `aarch64-unknown-linux-gnueabi`
117125
# by crosstool-ng, but Ubuntu just prefixes it with `aarch64-linux-gnu` so
118126
# we'll, additionally, strip the eabi part from its binaries.
@@ -121,6 +129,10 @@ RUN \
121129
g=`basename $f`; \
122130
ln -vs $f /usr/bin/`echo $g | sed -e 's/-unknown//'`; \
123131
done && \
132+
for f in `ls /x-tools/*-ibm-linux-*/bin/*-ibm-linux-*`; do \
133+
g=`basename $f`; \
134+
ln -vs $f /usr/bin/`echo $g | sed -e 's/-ibm//'`; \
135+
done && \
124136
for f in `ls /usr/bin/aarch64-linux-gnueabi-*`; do \
125137
g=`basename $f`; \
126138
mv -v $f /usr/bin/`echo $g | sed -e 's/eabi//'`; \
@@ -184,8 +196,8 @@ ENV AR_armv7_unknown_linux_gnueabihf=armv7-linux-gnueabihf-ar \
184196
CC_mipsel_unknown_linux_musl=mipsel-linux-musl-gcc \
185197
CXX_mipsel_unknown_linux_musl=mipsel-linux-musl-g++ \
186198
AR_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-ar \
187-
CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc-5 \
188-
CXX_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-g++-5 \
199+
CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \
200+
CXX_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-g++ \
189201
AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
190202
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
191203
CXX_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-g++ \

slaves/linux-cross/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,56 @@ For targets: `mipsel-unknown-linux-musl`
223223
(+) These options have been selected to match the gcc flags we use to compile C
224224
libraries like jemalloc. See the mk/cfg/mips(el)-uknown-linux-musl.mk
225225
file in Rust's source code.
226+
227+
## `powerpc-linux-gnu.config`
228+
229+
For targets: `powerpc-unknown-linux-gnu`
230+
231+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
232+
- Target options > Target Architecture = powerpc
233+
- Operating System > Target OS = linux
234+
- Operating System > Linux kernel version = 3.10.93 -- ~RHEL7 kernel
235+
- C-library > glibc version = 2.17 -- ~RHEL7 glibc
236+
- C compiler > gcc version = 5.2
237+
- C compiler > C++ = ENABLE -- to cross compile LLVM
238+
239+
## `powerpc64-linux-gnu.config`
240+
241+
For targets: `powerpc64-unknown-linux-gnu`
242+
243+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
244+
- Target options > Target Architecture = powerpc
245+
- Target options > Bitness = 64-bit
246+
- Operating System > Target OS = linux
247+
- Operating System > Linux kernel version = 3.10.93 -- ~RHEL7 kernel
248+
- C-library > glibc version = 2.17 -- ~RHEL7 glibc
249+
- C compiler > gcc version = 5.2
250+
- C compiler > C++ = ENABLE -- to cross compile LLVM
251+
252+
## `powerpc64le-linux-gnu.config`
253+
254+
For targets: `powerpc64le-unknown-linux-gnu`
255+
256+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
257+
- Target options > Target Architecture = powerpc
258+
- Target options > Endianness = **Little** endian
259+
- Target options > Bitness = 64-bit
260+
- Target options > Emit assembly for CPU = power8
261+
- Operating System > Target OS = linux
262+
- Operating System > Linux kernel version = 3.14.57 -- ppc64le support was introduced in 3.13
263+
- C-library > glibc version = 2.19 -- ppc64le support was introduced in this version
264+
- C compiler > gcc version = 5.2.0
265+
- C compiler > C++ = ENABLE -- to cross compile LLVM
266+
267+
## `s390x-linux-gnu.config`
268+
269+
For targets: `s390x-unknown-linux-gnu`
270+
271+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
272+
- Target options > Target Architecture = s390
273+
- Target options > Bitness = 64-bit
274+
- Operating System > Target OS = linux
275+
- Operating System > Linux kernel version = 3.10.93 -- ~RHEL7 kernel
276+
- C-library > glibc version = 2.17 -- ~RHEL7 glibc
277+
- C compiler > gcc version = 5.2
278+
- C compiler > C++ = ENABLE -- to cross compile LLVM

0 commit comments

Comments
 (0)