Skip to content

Commit d01e22e

Browse files
committed
Auto merge of #39382 - cuviper:ibm-rewind, r=alexcrichton
travis: move IBM backwards in time Using Ubuntu's cross-toolchains for powerpc* and s390x meant they 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, powerpc64, and s390x to use crosstool-ng toolchains, configured approximately like RHEL6 with kernel 2.6.32 and glibc 2.12. This ABI level should also be compatible with Debian 7 (wheezy) and Ubuntu 12.04 (precise). For powerpc64le, the challenge was that only glibc-2.19 officially added support, but RHEL7 backported those changes to glibc-2.17. The backport patches are complex and numerous, so instead of trying to push those into crosstool-ng, this just uses glibc binaries directly from CentOS 7 and builds the toolchain manually. This is ported from rust-lang-deprecated/rust-buildbot#149. r? @alexcrichton
2 parents 4be49e1 + cb47d9f commit d01e22e

16 files changed

+2119
-35
lines changed

src/ci/docker/README.md

+55
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,58 @@ For targets: `aarch64-unknown-linux-gnu`
143143
- C-library > glibc version = 2.17 -- aarch64 support was introduced in this version
144144
- C compiler > gcc version = 5.2.0
145145
- C compiler > C++ = ENABLE -- to cross compile LLVM
146+
147+
## `powerpc-linux-gnu.config`
148+
149+
For targets: `powerpc-unknown-linux-gnu`
150+
151+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
152+
- Path and misc options > Patches origin = Bundled, then local
153+
- Path and misc options > Local patch directory = /tmp/patches
154+
- Target options > Target Architecture = powerpc
155+
- Target options > Emit assembly for CPU = power4 -- (+)
156+
- Target options > Tune for CPU = power6 -- (+)
157+
- Operating System > Target OS = linux
158+
- Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
159+
- C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
160+
- C compiler > gcc version = 4.9.3
161+
- C compiler > Core gcc extra config = --with-cpu-32=power4 --with-cpu=default32 -- (+)
162+
- C compiler > gcc extra config = --with-cpu-32=power4 --with-cpu=default32 -- (+)
163+
- C compiler > C++ = ENABLE -- to cross compile LLVM
164+
165+
(+) These CPU options match the configuration of the toolchains in RHEL6.
166+
167+
## `powerpc64-linux-gnu.config`
168+
169+
For targets: `powerpc64-unknown-linux-gnu`
170+
171+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
172+
- Path and misc options > Patches origin = Bundled, then local
173+
- Path and misc options > Local patch directory = /tmp/patches
174+
- Target options > Target Architecture = powerpc
175+
- Target options > Bitness = 64-bit
176+
- Target options > Emit assembly for CPU = power4 -- (+)
177+
- Target options > Tune for CPU = power6 -- (+)
178+
- Operating System > Target OS = linux
179+
- Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
180+
- C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
181+
- C compiler > gcc version = 4.9.3
182+
- C compiler > C++ = ENABLE -- to cross compile LLVM
183+
184+
(+) These CPU options match the configuration of the toolchains in RHEL6.
185+
186+
## `s390x-linux-gnu.config`
187+
188+
For targets: `s390x-unknown-linux-gnu`
189+
190+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
191+
- Path and misc options > Patches origin = Bundled, then local
192+
- Path and misc options > Local patch directory = /build/patches
193+
- Target options > Target Architecture = s390
194+
- Target options > Bitness = 64-bit
195+
- Operating System > Target OS = linux
196+
- Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
197+
- C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
198+
- C compiler > gcc version = 4.9.3
199+
- C compiler > gcc extra config = --with-arch=z10 -- LLVM's minimum support
200+
- C compiler > C++ = ENABLE -- to cross compile LLVM

src/ci/docker/dist-powerpc-linux/Dockerfile

+56-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
FROM ubuntu:16.04
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
automake \
5+
bison \
6+
bzip2 \
7+
ca-certificates \
8+
cmake \
9+
curl \
10+
file \
11+
flex \
412
g++ \
13+
gawk \
14+
gdb \
15+
git \
16+
gperf \
17+
help2man \
18+
libncurses-dev \
19+
libtool-bin \
520
make \
6-
file \
7-
curl \
8-
ca-certificates \
21+
patch \
922
python2.7 \
10-
git \
11-
cmake \
1223
sudo \
13-
gdb \
14-
xz-utils \
15-
g++-powerpc-linux-gnu
24+
texinfo \
25+
wget \
26+
xz-utils
1627

1728
ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
1829
RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
@@ -23,6 +34,43 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
2334
rm dumb-init_*.deb
2435
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
2536

37+
# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
38+
# toolchains we build below chokes on that, so go back to make 3
39+
RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
40+
cd make-3.81 && \
41+
./configure --prefix=/usr && \
42+
make && \
43+
make install && \
44+
cd .. && \
45+
rm -rf make-3.81
46+
47+
RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
48+
tar xjf - && \
49+
cd crosstool-ng && \
50+
./configure --prefix=/usr/local && \
51+
make -j$(nproc) && \
52+
make install && \
53+
cd .. && \
54+
rm -rf crosstool-ng
55+
56+
RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
57+
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
58+
USER rustbuild
59+
WORKDIR /tmp
60+
61+
COPY patches/ /tmp/patches/
62+
COPY powerpc-linux-gnu.config build-powerpc-toolchain.sh /tmp/
63+
RUN ./build-powerpc-toolchain.sh
64+
65+
USER root
66+
67+
ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin
68+
69+
ENV \
70+
CC_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-gcc \
71+
AR_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-ar \
72+
CXX_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-g++
73+
2674
ENV HOSTS=powerpc-unknown-linux-gnu
2775

2876
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ex
13+
14+
hide_output() {
15+
set +x
16+
on_err="
17+
echo ERROR: An error was encountered with the build.
18+
cat /tmp/build.log
19+
exit 1
20+
"
21+
trap "$on_err" ERR
22+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
23+
PING_LOOP_PID=$!
24+
$@ &> /tmp/build.log
25+
rm /tmp/build.log
26+
trap - ERR
27+
kill $PING_LOOP_PID
28+
set -x
29+
}
30+
31+
mkdir build
32+
cd build
33+
cp ../powerpc-linux-gnu.config .config
34+
hide_output ct-ng build
35+
cd ..
36+
rm -rf build
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From b3563932f85d60bb0d38b0a5f3b8f4abc133f890 Mon Sep 17 00:00:00 2001
2+
From: Tulio Magno Quites Machado Filho <[email protected]>
3+
Date: Thu, 1 Nov 2012 18:00:06 -0500
4+
Subject: [PATCH] PowerPC: Remove unnecessary -mnew-mnemonics.
5+
6+
---
7+
sysdeps/powerpc/Makefile | 4 ----
8+
1 file changed, 4 deletions(-)
9+
10+
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
11+
index 79dd6fa976d5..7442b6709ad1 100644
12+
--- a/sysdeps/powerpc/Makefile
13+
+++ b/sysdeps/powerpc/Makefile
14+
@@ -1,7 +1,3 @@
15+
-# We always want to use the new mnemonic syntax even if we are on a RS6000
16+
-# machine.
17+
-+cflags += -mnew-mnemonics
18+
-
19+
ifeq ($(subdir),gmon)
20+
sysdep_routines += ppc-mcount
21+
endif
22+
--
23+
2.9.3
24+

0 commit comments

Comments
 (0)