mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-07 09:41:39 +01:00
alpine-target.patch adds new targets to avoid tampering the upstream musl target. These targets use upstream targets as a base and apply some Alpine-specific tweaks (mostly, dynamically link musl). musl-fix-linux_musl_base.patch changes the upstream targets with Alpine-specific changes, which are then inherited by the Alpine targets. As a side-effect, it also changes the behaviour of the upstream targets. This change merges both patches into one, applying our local changes specifically to our own targets while leaving upstream targets in their original form. When building with Alpine as a target, this is functionally identical. When building one of the upstream musl targets, this retains the upstream behaviour. This new patch is more suitable for submitting upstream. --- Tested by building multiple aports in a rootbld as well as building multiple third party projects from a clean checkout.
321 lines
13 KiB
Diff
321 lines
13 KiB
Diff
From 90bc64a1ddebc0ada09c6061aa7919c1a15bf06a Mon Sep 17 00:00:00 2001
|
|
From: Shiz <hi@shiz.me>
|
|
Date: Thu, 20 Aug 2017 01:52:36 +0200
|
|
Subject: [PATCH] Add Alpine targets
|
|
|
|
Add `$arch-alpine-linux-musl` targets to Rust to encode our toolchain
|
|
and distribution-specific quirks instead of polluting the main musl target of
|
|
`$arch-unknown-linux-musl`.
|
|
|
|
Co-Authored-By: Rasmus Thomsen <oss@cogitri.dev>
|
|
Co-Authored-By: Ariadne Conill <ariadne@dereferenced.org>
|
|
Co-Authored-By: Jakub Jirutka <jakub@jirutka.cz>
|
|
Co-Authored-By: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
|
|
|
|
---
|
|
|
|
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
|
|
index 303be54a6d7..0868e1f29b4 100644
|
|
--- a/compiler/rustc_target/src/spec/mod.rs
|
|
+++ b/compiler/rustc_target/src/spec/mod.rs
|
|
@@ -1736,6 +1736,18 @@ fn $module() {
|
|
}
|
|
|
|
supported_targets! {
|
|
+ ("i586-alpine-linux-musl", i586_alpine_linux_musl),
|
|
+ ("x86_64-alpine-linux-musl", x86_64_alpine_linux_musl),
|
|
+ ("aarch64-alpine-linux-musl", aarch64_alpine_linux_musl),
|
|
+ ("armv6-alpine-linux-musleabihf", armv6_alpine_linux_musleabihf),
|
|
+ ("armv7-alpine-linux-musleabihf", armv7_alpine_linux_musleabihf),
|
|
+ ("powerpc-alpine-linux-musl", powerpc_alpine_linux_musl),
|
|
+ ("powerpc64-alpine-linux-musl", powerpc64_alpine_linux_musl),
|
|
+ ("powerpc64le-alpine-linux-musl", powerpc64le_alpine_linux_musl),
|
|
+ ("s390x-alpine-linux-musl", s390x_alpine_linux_musl),
|
|
+ ("riscv64-alpine-linux-musl", riscv64_alpine_linux_musl),
|
|
+ ("loongarch64-alpine-linux-musl", loongarch64_alpine_linux_musl),
|
|
+ ("mips64-alpine-linux-musl", mips64_alpine_linux_musl),
|
|
("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
|
|
("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32),
|
|
("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
|
|
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..ae2c45db79d
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/aarch64_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::aarch64_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "aarch64-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/armv6_alpine_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv6_alpine_linux_musleabihf.rs
|
|
new file mode 100644
|
|
index 00000000000..faf23ce2c73
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/armv6_alpine_linux_musleabihf.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::arm_unknown_linux_musleabihf::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "armv6-alpine-linux-musleabihf".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/armv7_alpine_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_alpine_linux_musleabihf.rs
|
|
new file mode 100644
|
|
index 00000000000..bb62f8b71f6
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/armv7_alpine_linux_musleabihf.rs
|
|
@@ -0,0 +1,18 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::armv7_unknown_linux_musleabihf::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "armv7-alpine-linux-musleabihf".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+ base.options.features = "+v7,+vfp3,-d32,+thumb-mode,+thumb2".into();
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/i586_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/i586_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..a4a99dfb8df
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/i586_alpine_linux_musl.rs
|
|
@@ -0,0 +1,18 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::i686_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.options.cpu = "pentium4".into();
|
|
+ base.llvm_target = "i586-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..79ca830042e
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/loongarch64_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::loongarch64_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "loongarch64-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/mips64_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/mips64_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..ab032f5ba20
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/mips64_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::mips64_unknown_linux_muslabi64::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "mips64-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..12d2421c082
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::powerpc64_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "powerpc64-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..a4406302aaa
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::powerpc64le_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "powerpc64le-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..31372d67a74
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/powerpc_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::powerpc_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "powerpc-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/riscv64_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..5a8e8ce6692
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/riscv64_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::riscv64gc_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "riscv64-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/s390x_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/s390x_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..ce6cfbdbc0f
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/s390x_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::s390x_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "s390x-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_alpine_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_alpine_linux_musl.rs
|
|
new file mode 100644
|
|
index 00000000000..3d3ca078f39
|
|
--- /dev/null
|
|
+++ b/compiler/rustc_target/src/spec/targets/x86_64_alpine_linux_musl.rs
|
|
@@ -0,0 +1,17 @@
|
|
+use crate::spec::{LinkSelfContainedDefault, Target};
|
|
+
|
|
+pub(crate) fn target() -> Target {
|
|
+ let mut base = super::x86_64_unknown_linux_musl::target();
|
|
+
|
|
+ base.pre_link_objects_self_contained = Default::default();
|
|
+ base.post_link_objects_self_contained = Default::default();
|
|
+ base.link_self_contained = LinkSelfContainedDefault::False;
|
|
+
|
|
+ base.llvm_target = "x86_64-alpine-linux-musl".into();
|
|
+ base.options.vendor = "alpine".into();
|
|
+ base.options.crt_static_default = false;
|
|
+ base.options.static_position_independent_executables = true;
|
|
+ base.options.need_rpath = true;
|
|
+
|
|
+ base
|
|
+}
|
|
--
|
|
2.50.1
|
|
|