| 1 | From e84c60a2c50d951a614a414202a88fdb65ead0c3 Mon Sep 17 00:00:00 2001
|
| 2 | From: Shiz <[email protected]>
|
| 3 | Date: Sun, 20 Aug 2017 01:52:36 +0200
|
| 4 | Subject: [PATCH] Add Alpine targets
|
| 5 |
|
| 6 | Add `$arch-alpine-linux-musl` targets to Rust to encode our toolchain
|
| 7 | and distribution-specific quirks instead of polluting the main musl target of
|
| 8 | `$arch-unknown-linux-musl`.
|
| 9 |
|
| 10 | Co-Authored-By: Rasmus Thomsen <[email protected]>
|
| 11 | Co-Authored-By: Ariadne Conill <[email protected]>
|
| 12 | Co-Authored-By: Jakub Jirutka <[email protected]>
|
| 13 | Co-Authored-By: Hugo Osvaldo Barrera <[email protected]>
|
| 14 | Co-Authored-By: q66 <[email protected]>
|
| 15 | Signed-off-by: Achill Gilgenast <[email protected]>
|
| 16 | ---
|
| 17 | compiler/rustc_target/src/spec/base/linux_musl.rs | 11 +++++++----
|
| 18 | compiler/rustc_target/src/spec/mod.rs | 12 ++++++++++++
|
| 19 | .../src/spec/targets/aarch64_alpine_linux_musl.rs | 11 +++++++++++
|
| 20 | .../spec/targets/armv6_alpine_linux_musleabihf.rs | 11 +++++++++++
|
| 21 | .../spec/targets/armv7_alpine_linux_musleabihf.rs | 12 ++++++++++++
|
| 22 | .../src/spec/targets/i586_alpine_linux_musl.rs | 12 ++++++++++++
|
| 23 | .../spec/targets/loongarch64_alpine_linux_musl.rs | 10 ++++++++++
|
| 24 | .../src/spec/targets/mips64_alpine_linux_musl.rs | 10 ++++++++++
|
| 25 | .../src/spec/targets/powerpc64_alpine_linux_musl.rs | 10 ++++++++++
|
| 26 | .../spec/targets/powerpc64le_alpine_linux_musl.rs | 11 +++++++++++
|
| 27 | .../src/spec/targets/powerpc_alpine_linux_musl.rs | 10 ++++++++++
|
| 28 | .../src/spec/targets/riscv64_alpine_linux_musl.rs | 10 ++++++++++
|
| 29 | .../src/spec/targets/s390x_alpine_linux_musl.rs | 10 ++++++++++
|
| 30 | .../src/spec/targets/x86_64_alpine_linux_musl.rs | 11 +++++++++++
|
| 31 | 14 files changed, 147 insertions(+), 4 deletions(-)
|
| 32 | create mode 100644 compiler/rustc_target/src/spec/targets/aarch64_alpine_linux_musl.rs
|
| 33 | create mode 100644 compiler/rustc_target/src/spec/targets/armv6_alpine_linux_musleabihf.rs
|
| 34 | create mode 100644 compiler/rustc_target/src/spec/targets/armv7_alpine_linux_musleabihf.rs
|
| 35 | create mode 100644 compiler/rustc_target/src/spec/targets/i586_alpine_linux_musl.rs
|
| 36 | create mode 100644 compiler/rustc_target/src/spec/targets/loongarch64_alpine_linux_musl.rs
|
| 37 | create mode 100644 compiler/rustc_target/src/spec/targets/mips64_alpine_linux_musl.rs
|
| 38 | create mode 100644 compiler/rustc_target/src/spec/targets/powerpc64_alpine_linux_musl.rs
|
| 39 | create mode 100644 compiler/rustc_target/src/spec/targets/powerpc64le_alpine_linux_musl.rs
|
| 40 | create mode 100644 compiler/rustc_target/src/spec/targets/powerpc_alpine_linux_musl.rs
|
| 41 | create mode 100644 compiler/rustc_target/src/spec/targets/riscv64_alpine_linux_musl.rs
|
| 42 | create mode 100644 compiler/rustc_target/src/spec/targets/s390x_alpine_linux_musl.rs
|
| 43 | create mode 100644 compiler/rustc_target/src/spec/targets/x86_64_alpine_linux_musl.rs
|
| 44 |
|
| 45 | diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs
|
| 46 | index 6d3124b..0227c52 100644
|
| 47 | |
| 48 | |
| 49 | @@ -1,11 +1,14 @@
|
| 50 | -use crate::spec::{Env, LinkSelfContainedDefault, TargetOptions, base, crt_objects};
|
| 51 | +use crate::spec::{Env, TargetOptions, base};
|
| 52 |
|
| 53 | pub(crate) fn opts() -> TargetOptions {
|
| 54 | TargetOptions {
|
| 55 | env: Env::Musl,
|
| 56 | - pre_link_objects_self_contained: crt_objects::pre_musl_self_contained(),
|
| 57 | - post_link_objects_self_contained: crt_objects::post_musl_self_contained(),
|
| 58 | - link_self_contained: LinkSelfContainedDefault::InferredForMusl,
|
| 59 | + // use static pie by default
|
| 60 | + static_position_independent_executables: true,
|
| 61 | + // we want to link to default libraries in order to reliably
|
| 62 | + // get in the builtins; this will also link in libc, which
|
| 63 | + // we likewise want (and avoid hacks in the libc module)
|
| 64 | + no_default_libraries: false,
|
| 65 | ..base::linux::opts()
|
| 66 | }
|
| 67 | }
|
| 68 | diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
|
| 69 | index 57effe3..aac1cc3 100644
|
| 70 | |
| 71 | |
| 72 | @@ -1439,6 +1439,18 @@ macro_rules! supported_targets {
|
| 73 | }
|
| 74 |
|
| 75 | supported_targets! {
|
| 76 | + ("i586-alpine-linux-musl", i586_alpine_linux_musl),
|
| 77 | + ("x86_64-alpine-linux-musl", x86_64_alpine_linux_musl),
|
| 78 | + ("aarch64-alpine-linux-musl", aarch64_alpine_linux_musl),
|
| 79 | + ("armv6-alpine-linux-musleabihf", armv6_alpine_linux_musleabihf),
|
| 80 | + ("armv7-alpine-linux-musleabihf", armv7_alpine_linux_musleabihf),
|
| 81 | + ("powerpc-alpine-linux-musl", powerpc_alpine_linux_musl),
|
| 82 | + ("powerpc64-alpine-linux-musl", powerpc64_alpine_linux_musl),
|
| 83 | + ("powerpc64le-alpine-linux-musl", powerpc64le_alpine_linux_musl),
|
| 84 | + ("s390x-alpine-linux-musl", s390x_alpine_linux_musl),
|
| 85 | + ("riscv64-alpine-linux-musl", riscv64_alpine_linux_musl),
|
| 86 | + ("loongarch64-alpine-linux-musl", loongarch64_alpine_linux_musl),
|
| 87 | + ("mips64-alpine-linux-musl", mips64_alpine_linux_musl),
|
| 88 | ("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
|
| 89 | ("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32),
|
| 90 | ("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
|
| 91 | 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
|
| 92 | new file mode 100644
|
| 93 | index 0000000..a91c546
|
| 94 | |
| 95 | |
| 96 | @@ -0,0 +1,11 @@
|
| 97 | +use crate::spec::Target;
|
| 98 | +
|
| 99 | +pub(crate) fn target() -> Target {
|
| 100 | + let mut base = super::aarch64_unknown_linux_musl::target();
|
| 101 | +
|
| 102 | + base.llvm_target = "aarch64-alpine-linux-musl".into();
|
| 103 | + base.options.vendor = "alpine".into();
|
| 104 | + base.options.crt_static_default = false;
|
| 105 | +
|
| 106 | + base
|
| 107 | +}
|
| 108 | 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
|
| 109 | new file mode 100644
|
| 110 | index 0000000..d93c689
|
| 111 | |
| 112 | |
| 113 | @@ -0,0 +1,11 @@
|
| 114 | +use crate::spec::Target;
|
| 115 | +
|
| 116 | +pub(crate) fn target() -> Target {
|
| 117 | + let mut base = super::arm_unknown_linux_musleabihf::target();
|
| 118 | +
|
| 119 | + base.llvm_target = "armv6-alpine-linux-musleabihf".into();
|
| 120 | + base.options.vendor = "alpine".into();
|
| 121 | + base.options.crt_static_default = false;
|
| 122 | +
|
| 123 | + base
|
| 124 | +}
|
| 125 | 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
|
| 126 | new file mode 100644
|
| 127 | index 0000000..ca18e82
|
| 128 | |
| 129 | |
| 130 | @@ -0,0 +1,12 @@
|
| 131 | +use crate::spec::Target;
|
| 132 | +
|
| 133 | +pub(crate) fn target() -> Target {
|
| 134 | + let mut base = super::armv7_unknown_linux_musleabihf::target();
|
| 135 | +
|
| 136 | + base.llvm_target = "armv7-alpine-linux-musleabihf".into();
|
| 137 | + base.options.vendor = "alpine".into();
|
| 138 | + base.options.crt_static_default = false;
|
| 139 | + base.options.features = "+v7,+vfp3,-d32,+thumb-mode,+thumb2".into();
|
| 140 | +
|
| 141 | + base
|
| 142 | +}
|
| 143 | 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
|
| 144 | new file mode 100644
|
| 145 | index 0000000..62ccbf4
|
| 146 | |
| 147 | |
| 148 | @@ -0,0 +1,12 @@
|
| 149 | +use crate::spec::Target;
|
| 150 | +
|
| 151 | +pub(crate) fn target() -> Target {
|
| 152 | + let mut base = super::i686_unknown_linux_musl::target();
|
| 153 | +
|
| 154 | + base.options.cpu = "pentium4".into();
|
| 155 | + base.llvm_target = "i586-alpine-linux-musl".into();
|
| 156 | + base.options.vendor = "alpine".into();
|
| 157 | + base.options.crt_static_default = false;
|
| 158 | +
|
| 159 | + base
|
| 160 | +}
|
| 161 | 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
|
| 162 | new file mode 100644
|
| 163 | index 0000000..b4454a4
|
| 164 | |
| 165 | |
| 166 | @@ -0,0 +1,10 @@
|
| 167 | +use crate::spec::Target;
|
| 168 | +
|
| 169 | +pub(crate) fn target() -> Target {
|
| 170 | + let mut base = super::loongarch64_unknown_linux_musl::target();
|
| 171 | +
|
| 172 | + base.llvm_target = "loongarch64-alpine-linux-musl".into();
|
| 173 | + base.options.vendor = "alpine".into();
|
| 174 | +
|
| 175 | + base
|
| 176 | +}
|
| 177 | 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
|
| 178 | new file mode 100644
|
| 179 | index 0000000..cff4ab0
|
| 180 | |
| 181 | |
| 182 | @@ -0,0 +1,10 @@
|
| 183 | +use crate::spec::Target;
|
| 184 | +
|
| 185 | +pub(crate) fn target() -> Target {
|
| 186 | + let mut base = super::mips64_unknown_linux_muslabi64::target();
|
| 187 | +
|
| 188 | + base.llvm_target = "mips64-alpine-linux-musl".into();
|
| 189 | + base.options.vendor = "alpine".into();
|
| 190 | +
|
| 191 | + base
|
| 192 | +}
|
| 193 | 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
|
| 194 | new file mode 100644
|
| 195 | index 0000000..cb34eda
|
| 196 | |
| 197 | |
| 198 | @@ -0,0 +1,10 @@
|
| 199 | +use crate::spec::Target;
|
| 200 | +
|
| 201 | +pub(crate) fn target() -> Target {
|
| 202 | + let mut base = super::powerpc64_unknown_linux_musl::target();
|
| 203 | +
|
| 204 | + base.llvm_target = "powerpc64-alpine-linux-musl".into();
|
| 205 | + base.options.vendor = "alpine".into();
|
| 206 | +
|
| 207 | + base
|
| 208 | +}
|
| 209 | 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
|
| 210 | new file mode 100644
|
| 211 | index 0000000..d510382
|
| 212 | |
| 213 | |
| 214 | @@ -0,0 +1,11 @@
|
| 215 | +use crate::spec::Target;
|
| 216 | +
|
| 217 | +pub(crate) fn target() -> Target {
|
| 218 | + let mut base = super::powerpc64le_unknown_linux_musl::target();
|
| 219 | +
|
| 220 | + base.llvm_target = "powerpc64le-alpine-linux-musl".into();
|
| 221 | + base.options.vendor = "alpine".into();
|
| 222 | + base.options.crt_static_default = false;
|
| 223 | +
|
| 224 | + base
|
| 225 | +}
|
| 226 | 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
|
| 227 | new file mode 100644
|
| 228 | index 0000000..cc0fec4
|
| 229 | |
| 230 | |
| 231 | @@ -0,0 +1,10 @@
|
| 232 | +use crate::spec::Target;
|
| 233 | +
|
| 234 | +pub(crate) fn target() -> Target {
|
| 235 | + let mut base = super::powerpc_unknown_linux_musl::target();
|
| 236 | +
|
| 237 | + base.llvm_target = "powerpc-alpine-linux-musl".into();
|
| 238 | + base.options.vendor = "alpine".into();
|
| 239 | +
|
| 240 | + base
|
| 241 | +}
|
| 242 | 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
|
| 243 | new file mode 100644
|
| 244 | index 0000000..3b2e8cc
|
| 245 | |
| 246 | |
| 247 | @@ -0,0 +1,10 @@
|
| 248 | +use crate::spec::Target;
|
| 249 | +
|
| 250 | +pub(crate) fn target() -> Target {
|
| 251 | + let mut base = super::riscv64gc_unknown_linux_musl::target();
|
| 252 | +
|
| 253 | + base.llvm_target = "riscv64-alpine-linux-musl".into();
|
| 254 | + base.options.vendor = "alpine".into();
|
| 255 | +
|
| 256 | + base
|
| 257 | +}
|
| 258 | 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
|
| 259 | new file mode 100644
|
| 260 | index 0000000..acf2876
|
| 261 | |
| 262 | |
| 263 | @@ -0,0 +1,10 @@
|
| 264 | +use crate::spec::Target;
|
| 265 | +
|
| 266 | +pub(crate) fn target() -> Target {
|
| 267 | + let mut base = super::s390x_unknown_linux_musl::target();
|
| 268 | +
|
| 269 | + base.llvm_target = "s390x-alpine-linux-musl".into();
|
| 270 | + base.options.vendor = "alpine".into();
|
| 271 | +
|
| 272 | + base
|
| 273 | +}
|
| 274 | 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
|
| 275 | new file mode 100644
|
| 276 | index 0000000..0492ee5
|
| 277 | |
| 278 | |
| 279 | @@ -0,0 +1,11 @@
|
| 280 | +use crate::spec::Target;
|
| 281 | +
|
| 282 | +pub(crate) fn target() -> Target {
|
| 283 | + let mut base = super::x86_64_unknown_linux_musl::target();
|
| 284 | +
|
| 285 | + base.llvm_target = "x86_64-alpine-linux-musl".into();
|
| 286 | + base.options.vendor = "alpine".into();
|
| 287 | + base.options.crt_static_default = false;
|
| 288 | +
|
| 289 | + base
|
| 290 | +}
|
| 291 | --
|
| 292 | 2.53.0
|
| 293 |
|