mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-23 14:05:27 +00:00
add aarch64-unknown-linux-musl target
Signed-off-by: Ben Cressey <bcressey@amazon.com> Signed-off-by: Tom Kirchner <tjk@amazon.com>
This commit is contained in:
parent
a83c3e7771
commit
f94bd36fd1
@ -109,6 +109,8 @@ v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root",
|
||||
"arm-unknown-linux-musleabihf install directory")
|
||||
v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root",
|
||||
"armv7-unknown-linux-musleabihf install directory")
|
||||
v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
|
||||
"aarch64-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",
|
||||
|
@ -399,6 +399,7 @@ impl Step for Openssl {
|
||||
let os = match &*target {
|
||||
"aarch64-linux-android" => "linux-aarch64",
|
||||
"aarch64-unknown-linux-gnu" => "linux-aarch64",
|
||||
"aarch64-unknown-linux-musl" => "linux-aarch64",
|
||||
"arm-linux-androideabi" => "android",
|
||||
"arm-unknown-linux-gnueabi" => "linux-armv4",
|
||||
"arm-unknown-linux-gnueabihf" => "linux-armv4",
|
||||
|
@ -14,6 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
zlib1g-dev \
|
||||
g++-arm-linux-gnueabi \
|
||||
g++-arm-linux-gnueabihf \
|
||||
g++-aarch64-linux-gnu \
|
||||
gcc-sparc64-linux-gnu \
|
||||
libc6-dev-sparc64-cross \
|
||||
bzip2 \
|
||||
@ -46,6 +47,7 @@ ENV TARGETS=$TARGETS,mipsel-unknown-linux-musl
|
||||
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,sparc64-unknown-linux-gnu
|
||||
ENV TARGETS=$TARGETS,x86_64-unknown-redox
|
||||
|
||||
@ -62,7 +64,8 @@ ENV RUST_CONFIGURE_ARGS \
|
||||
--target=$TARGETS \
|
||||
--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-armv7=/usr/local/armv7-linux-musleabihf \
|
||||
--musl-root-aarch64=/usr/local/aarch64-linux-musl
|
||||
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
|
||||
|
||||
# sccache
|
||||
|
@ -65,11 +65,24 @@ CFLAGS="-march=armv7-a" \
|
||||
hide_output make -j$(nproc)
|
||||
hide_output make install
|
||||
cd ..
|
||||
rm -rf musl-$MUSL
|
||||
|
||||
tar xf musl-$MUSL.tar.gz
|
||||
cd musl-$MUSL
|
||||
CC=aarch64-linux-gnu-gcc \
|
||||
CFLAGS="" \
|
||||
hide_output ./configure \
|
||||
--prefix=/usr/local/aarch64-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
|
||||
|
||||
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 -
|
||||
@ -116,5 +129,19 @@ cp lib/libunwind.a /usr/local/armv7-linux-musleabihf/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=aarch64-linux-gnu-gcc \
|
||||
-DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
|
||||
-DCMAKE_C_FLAGS="" \
|
||||
-DCMAKE_CXX_FLAGS=""
|
||||
make -j$(nproc)
|
||||
cp lib/libunwind.a /usr/local/aarch64-linux-musl/lib
|
||||
cd ..
|
||||
rm -rf libunwind-build
|
||||
|
||||
rm -rf libunwind-release_39
|
||||
rm -rf llvm-release_39
|
||||
|
36
src/librustc_back/target/aarch64_unknown_linux_musl.rs
Normal file
36
src/librustc_back/target/aarch64_unknown_linux_musl.rs
Normal file
@ -0,0 +1,36 @@
|
||||
// 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use LinkerFlavor;
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_musl_base::opts();
|
||||
base.max_atomic_width = Some(128);
|
||||
|
||||
// see #36994
|
||||
base.exe_allocation_crate = None;
|
||||
|
||||
Ok(Target {
|
||||
llvm_target: "aarch64-unknown-linux-musl".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
target_env: "musl".to_string(),
|
||||
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
|
||||
arch: "aarch64".to_string(),
|
||||
target_os: "linux".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
linker_flavor: LinkerFlavor::Gcc,
|
||||
options: TargetOptions {
|
||||
abi_blacklist: super::arm_base::abi_blacklist(),
|
||||
.. base
|
||||
},
|
||||
})
|
||||
}
|
@ -153,6 +153,7 @@ supported_targets! {
|
||||
("armv7-unknown-linux-gnueabihf", armv7_unknown_linux_gnueabihf),
|
||||
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
|
||||
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),
|
||||
("aarch64-unknown-linux-musl", aarch64_unknown_linux_musl),
|
||||
("x86_64-unknown-linux-musl", x86_64_unknown_linux_musl),
|
||||
("i686-unknown-linux-musl", i686_unknown_linux_musl),
|
||||
("mips-unknown-linux-musl", mips_unknown_linux_musl),
|
||||
|
@ -50,6 +50,7 @@ static TARGETS: &'static [&'static str] = &[
|
||||
"aarch64-unknown-fuchsia",
|
||||
"aarch64-linux-android",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"aarch64-unknown-linux-musl",
|
||||
"arm-linux-androideabi",
|
||||
"arm-unknown-linux-gnueabi",
|
||||
"arm-unknown-linux-gnueabihf",
|
||||
|
Loading…
Reference in New Issue
Block a user