summaryrefslogtreecommitdiff
path: root/user/rust/0019-Add-powerpc64-unknown-linux-musl-target.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/rust/0019-Add-powerpc64-unknown-linux-musl-target.patch')
-rw-r--r--user/rust/0019-Add-powerpc64-unknown-linux-musl-target.patch118
1 files changed, 118 insertions, 0 deletions
diff --git a/user/rust/0019-Add-powerpc64-unknown-linux-musl-target.patch b/user/rust/0019-Add-powerpc64-unknown-linux-musl-target.patch
new file mode 100644
index 000000000..de0f2bc82
--- /dev/null
+++ b/user/rust/0019-Add-powerpc64-unknown-linux-musl-target.patch
@@ -0,0 +1,118 @@
+From 914179b27fdabbbd42da8206f46621a006e54180 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Tue, 7 Aug 2018 21:59:15 -0500
+Subject: [PATCH 19/29] Add powerpc64-unknown-linux-musl target
+
+---
+ src/bootstrap/native.rs | 5 +++
+ src/librustc_target/abi/call/powerpc64.rs | 2 +-
+ src/librustc_target/spec/mod.rs | 1 +
+ .../spec/powerpc64_unknown_linux_musl.rs | 35 +++++++++++++++++++
+ src/tools/build-manifest/src/main.rs | 1 +
+ 5 files changed, 43 insertions(+), 1 deletion(-)
+ create mode 100644 src/librustc_target/spec/powerpc64_unknown_linux_musl.rs
+
+diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
+index 7c32b8b546..186ef75189 100644
+--- a/src/bootstrap/native.rs
++++ b/src/bootstrap/native.rs
+@@ -637,6 +637,7 @@ impl Step for Openssl {
+ "powerpc-unknown-linux-musl" => "linux-ppc",
+ "powerpc-unknown-netbsd" => "BSD-generic32",
+ "powerpc64-unknown-linux-gnu" => "linux-ppc64",
++ "powerpc64-unknown-linux-musl" => "linux-ppc64",
+ "powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
+ "powerpc64le-unknown-linux-musl" => "linux-ppc64le",
+ "s390x-unknown-linux-gnu" => "linux64-s390x",
+@@ -664,6 +665,10 @@ impl Step for Openssl {
+ configure.arg("-mandroid");
+ configure.arg("-fomit-frame-pointer");
+ }
++ // OpenSSL ships incompatible ELFv1 ABI assembly code
++ if target == "powerpc64-unknown-linux-musl" {
++ configure.arg("no-asm");
++ }
+ if target == "sparc64-unknown-netbsd" {
+ // Need -m64 to get assembly generated correctly for sparc64.
+ configure.arg("-m64");
+diff --git a/src/librustc_target/abi/call/powerpc64.rs b/src/librustc_target/abi/call/powerpc64.rs
+index 9e616c034e..18d14495e2 100644
+--- a/src/librustc_target/abi/call/powerpc64.rs
++++ b/src/librustc_target/abi/call/powerpc64.rs
+@@ -19,7 +19,7 @@ use spec::HasTargetSpec;
+ #[derive(Debug, Clone, Copy, PartialEq)]
+ enum ABI {
+ ELFv1, // original ABI used for powerpc64 (big-endian)
+- ELFv2, // newer ABI used for powerpc64le
++ ELFv2, // newer ABI used for powerpc64le and musl (both endians)
+ }
+ use self::ABI::*;
+
+diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs
+index f09e5a7465..94aa07abb6 100644
+--- a/src/librustc_target/spec/mod.rs
++++ b/src/librustc_target/spec/mod.rs
+@@ -274,6 +274,7 @@ supported_targets! {
+ ("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
+ ("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl),
+ ("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
++ ("powerpc64-unknown-linux-musl", powerpc64_unknown_linux_musl),
+ ("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
+ ("powerpc64le-unknown-linux-musl", powerpc64le_unknown_linux_musl),
+ ("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu),
+diff --git a/src/librustc_target/spec/powerpc64_unknown_linux_musl.rs b/src/librustc_target/spec/powerpc64_unknown_linux_musl.rs
+new file mode 100644
+index 0000000000..24ff9e0ecd
+--- /dev/null
++++ b/src/librustc_target/spec/powerpc64_unknown_linux_musl.rs
+@@ -0,0 +1,35 @@
++// Copyright 2018 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 spec::{LinkerFlavor, Target, TargetResult};
++
++pub fn target() -> TargetResult {
++ let mut base = super::linux_musl_base::opts();
++ base.cpu = "ppc64".to_string();
++ base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
++ base.max_atomic_width = Some(64);
++
++ // see #36994
++ base.exe_allocation_crate = None;
++
++ Ok(Target {
++ llvm_target: "powerpc64-unknown-linux-musl".to_string(),
++ target_endian: "big".to_string(),
++ target_pointer_width: "64".to_string(),
++ target_c_int_width: "32".to_string(),
++ data_layout: "E-m:e-i64:64-n32:64".to_string(),
++ arch: "powerpc64".to_string(),
++ target_os: "linux".to_string(),
++ target_env: "musl".to_string(),
++ target_vendor: "unknown".to_string(),
++ linker_flavor: LinkerFlavor::Gcc,
++ options: base,
++ })
++}
+diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
+index 7659d24f47..e20f9fe216 100644
+--- a/src/tools/build-manifest/src/main.rs
++++ b/src/tools/build-manifest/src/main.rs
+@@ -88,6 +88,7 @@ static TARGETS: &'static [&'static str] = &[
+ "powerpc-unknown-linux-gnuspe",
+ "powerpc-unknown-linux-musl",
+ "powerpc64-unknown-linux-gnu",
++ "powerpc64-unknown-linux-musl",
+ "powerpc64le-unknown-linux-gnu",
+ "powerpc64le-unknown-linux-musl",
+ "s390x-unknown-linux-gnu",
+--
+2.18.0
+