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

Commit 9d404f0

Browse files
committed
Merge pull request #86 from japaric/aarch64
build a custom aarch C compiler
2 parents 8227ed0 + 4b49cf0 commit 9d404f0

File tree

3 files changed

+580
-7
lines changed

3 files changed

+580
-7
lines changed

slaves/linux-cross/Dockerfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ RUN apt-get install -y --force-yes --no-install-recommends \
66
python-dev python-pip stunnel \
77
bzip2 xz-utils \
88
g++ libc6-dev \
9-
g++-4.8-aarch64-linux-gnu libc6-dev-arm64-cross \
109
g++-4.8-powerpc-linux-gnu libc6-dev-powerpc-cross \
1110
g++-4.8-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \
1211
lib64gcc-4.8-dev-powerpc-cross libc6-dev-ppc64-powerpc-cross \
@@ -50,6 +49,7 @@ RUN /bin/bash build_toolchain_root.sh && \
5049
chown rustbuild:rustbuild /build && \
5150
chown rustbuild:rustbuild /x-tools
5251
COPY linux-cross/build_toolchain.sh \
52+
linux-cross/aarch64-linux-gnu.config \
5353
linux-cross/arm-linux-gnueabi.config \
5454
linux-cross/arm-linux-gnueabihf.config \
5555
linux-cross/mips-linux-musl.config \
@@ -58,14 +58,16 @@ COPY linux-cross/build_toolchain.sh \
5858
/build/
5959
USER rustbuild
6060

61-
# Build two full toolchains for the `arm-unknown-linux-gneuabi` and
62-
# `arm-unknown-linux-gnueabihf` targets. We build toolchains from scratch to
63-
# primarily move to an older glibc. Ubuntu does indeed have these toolchains in
64-
# its repositories (so we could install that package), but they package a
65-
# relatively newer version of glibc. In order for the binaries we produce to be
66-
# maximall compatible, we push the glibc version back to 2.14
61+
# Build three full toolchains for the `arm-unknown-linux-gneuabi`,
62+
# `arm-unknown-linux-gnueabihf` and `aarch64-unknown-linux-gnu` targets. We
63+
# build toolchains from scratch to primarily move to an older glibc. Ubuntu
64+
# does indeed have these toolchains in its repositories (so we could install
65+
# that package), but they package a relatively newer version of glibc. In order
66+
# for the binaries we produce to be maximall compatible, we push the glibc
67+
# version back to 2.14 for arm and 2.17 for aarch64
6768
RUN /bin/bash build_toolchain.sh arm-linux-gnueabi
6869
RUN /bin/bash build_toolchain.sh arm-linux-gnueabihf
70+
RUN /bin/bash build_toolchain.sh aarch64-linux-gnu
6971

7072
# Also build two full toolchains for the `{mips,mipsel}-unknown-linux-musl`
7173
# targets. Currently these are essentially aliases to run on OpenWRT devices and
@@ -101,10 +103,17 @@ USER root
101103
# Rename all the compilers we just built into /usr/bin and also without
102104
# `-unknown-` in the name because it appears lots of other compilers in Ubuntu
103105
# don't have this name in the component by default either.
106+
# Also the aarch64 compiler is prefixed with `aarch64-unknown-linux-gnueabi`
107+
# by crosstool-ng, but Ubuntu just prefixes it with `aarch64-linux-gnu` so
108+
# we'll, additionally, strip the eabi part from its binaries.
104109
RUN \
105110
for f in `ls /x-tools/*-unknown-linux-*/bin/*-unknown-linux-*`; do \
106111
g=`basename $f`; \
107112
ln -vs $f /usr/bin/`echo $g | sed -e 's/-unknown//'`; \
113+
done && \
114+
for f in `ls /usr/bin/aarch64-linux-gnueabi-*`; do \
115+
g=`basename $f`; \
116+
mv -v $f /usr/bin/`echo $g | sed -e 's/eabi//'`; \
108117
done
109118

110119
COPY linux-cross/build_freebsd_toolchain.sh /tmp/

slaves/linux-cross/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ For targets: `armv7-unknown-linux-gnueabihf`
128128
libraries like jemalloc. See the mk/cfg/arm(v7)-uknown-linux-gnueabi{,hf}.mk
129129
file in Rust's source code.
130130

131+
## `aarch64-linux-gnu.config`
132+
133+
For targets: `aarch64-unknown-linux-gnu`
134+
135+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
136+
- Target options > Target Architecture = arm
137+
- Target options > Bitness = 64-bit
138+
- Operating System > Target OS = linux
139+
- Operating System > Linux kernel version = 4.2.6
140+
- C-library > glibc version = 2.17 -- aarch64 support was introduced in this version
141+
- C compiler > gcc version = 5.2.0
142+
- C compiler > C++ = ENABLE -- to cross compile LLVM
143+
131144
## `mips-linux-musl.config`
132145

133146
For targets: `mips-unknown-linux-musl`

0 commit comments

Comments
 (0)