1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
From: Shiz <hi@shiz.me>, updated by Rasmus Thomsen <oss@cogitri.dev> on 6th of July 2019
Date: Thu, 20 Aug 2017 01:52:36 +0200
Last-Updated: Sat, 28 Oct 2017 20:23:00 +0200
Subject: [PATCH] Add Alpine targets
This adds `$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`.
--- a/src/librustc_target/spec/mod.rs.orig 2019-05-23 21:05:45.173347119 +0200
+++ b/src/librustc_target/spec/mod.rs 2019-05-23 21:06:39.006681699 +0200
@@ -328,6 +328,12 @@ macro_rules! supported_targets {
}
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),
+ ("powerpc64le-alpine-linux-musl", powerpc64le_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),
--- /dev/null
+++ b/src/librustc_target/spec/i586_alpine_linux_musl.rs
@@ -0,0 +1,35 @@
+// 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 crate::spec::{LinkerFlavor, Target, TargetResult};
+
+pub fn target() -> TargetResult {
+ let mut base = super::linux_musl_base::opts();
+ base.cpu = "pentium4".to_string();
+ base.max_atomic_width = Some(64);
+ base.stack_probes = true;
+ base.crt_static_default = false;
+ base.static_position_independent_executables = true;
+ base.need_rpath = true;
+
+ Ok(Target {
+ llvm_target: "i586-alpine-linux-musl".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "32".to_string(),
+ target_c_int_width: "32".to_string(),
+ data_layout: "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128".to_string(),
+ arch: "x86".to_string(),
+ target_os: "linux".to_string(),
+ target_env: "musl".to_string(),
+ target_vendor: "alpine".to_string(),
+ linker_flavor: LinkerFlavor::Gcc,
+ options: base,
+ })
+}
--- /dev/null
+++ b/src/librustc_target/spec/x86_64_alpine_linux_musl.rs
@@ -0,0 +1,35 @@
+// 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 crate::spec::{LinkerFlavor, Target, TargetResult};
+
+pub fn target() -> TargetResult {
+ let mut base = super::linux_musl_base::opts();
+ base.cpu = "x86-64".to_string();
+ base.max_atomic_width = Some(64);
+ base.stack_probes = true;
+ base.crt_static_default = false;
+ base.static_position_independent_executables = true;
+ base.need_rpath = true;
+
+ Ok(Target {
+ llvm_target: "x86_64-alpine-linux-musl".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "64".to_string(),
+ target_c_int_width: "32".to_string(),
+ data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
+ arch: "x86_64".to_string(),
+ target_os: "linux".to_string(),
+ target_env: "musl".to_string(),
+ target_vendor: "alpine".to_string(),
+ linker_flavor: LinkerFlavor::Gcc,
+ options: base,
+ })
+}
--- /dev/null
+++ b/src/librustc_target/spec/aarch64_alpine_linux_musl.rs
@@ -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 crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
+
+pub fn target() -> TargetResult {
+ let mut base = super::linux_musl_base::opts();
+ base.max_atomic_width = Some(128);
+ base.crt_static_default = false;
+ base.static_position_independent_executables = true;
+ base.need_rpath = true;
+
+ Ok(Target {
+ llvm_target: "aarch64-alpine-linux-musl".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "64".to_string(),
+ target_c_int_width: "32".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_env: "musl".to_string(),
+ target_vendor: "alpine".to_string(),
+ linker_flavor: LinkerFlavor::Gcc,
+ options: TargetOptions {
+ abi_blacklist: super::arm_base::abi_blacklist(),
+ .. base
+ },
+ })
+}
--- /dev/null
+++ b/src/librustc_target/spec/armv6_alpine_linux_musleabihf.rs
@@ -0,0 +1,41 @@
+// 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 crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
+
+pub fn target() -> TargetResult {
+ let mut base = super::linux_musl_base::opts();
+
+ // Most of these settings are copied from the arm_unknown_linux_gnueabihf
+ // target.
+ base.features = "+v6,+vfp2".to_string();
+ base.max_atomic_width = Some(64);
+ base.crt_static_default = false;
+ base.static_position_independent_executables = true;
+ base.need_rpath = true;
+
+ Ok(Target {
+ llvm_target: "arm-alpine-linux-musleabihf".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "32".to_string(),
+ target_c_int_width: "32".to_string(),
+ data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
+ arch: "arm".to_string(),
+ target_os: "linux".to_string(),
+ target_env: "musl".to_string(),
+ target_vendor: "alpine".to_string(),
+ linker_flavor: LinkerFlavor::Gcc,
+ options: TargetOptions {
+ abi_blacklist: super::arm_base::abi_blacklist(),
+ target_mcount: "\u{1}mcount".to_string(),
+ .. base
+ },
+ })
+}
--- /dev/null
+++ b/src/librustc_target/spec/armv7_alpine_linux_musleabihf.rs
@@ -0,0 +1,34 @@
+use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
+
+// This target is for musl Linux on ARMv7 without thumb-mode or NEON.
+
+pub fn target() -> TargetResult {
+ let mut base = super::linux_musl_base::opts();
+ base.crt_static_default = false;
+ base.static_position_independent_executables = true;
+ base.need_rpath = true;
+
+ Ok(Target {
+ llvm_target: "armv7-unknown-linux-muslabihf".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "32".to_string(),
+ target_c_int_width: "32".to_string(),
+ data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
+ arch: "arm".to_string(),
+ target_os: "linux".to_string(),
+ target_env: "musl".to_string(),
+ target_vendor: "alpine".to_string(),
+ linker_flavor: LinkerFlavor::Gcc,
+
+ // Most of these settings are copied from the armv7_unknown_linux_gnueabihf
+ // target.
+ options: TargetOptions {
+ features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
+ cpu: "generic".to_string(),
+ max_atomic_width: Some(64),
+ abi_blacklist: super::arm_base::abi_blacklist(),
+ target_mcount: "\u{1}mcount".to_string(),
+ .. base
+ }
+ })
+}
--- /dev/null
+++ b/src/librustc_target/spec/powerpc64le_alpine_linux_musl.rs
@@ -0,0 +1,28 @@
+use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
+
+pub fn target() -> TargetResult {
+ let mut base = super::linux_musl_base::opts();
+ base.cpu = "ppc64le".to_string();
+ base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string());
+ base.max_atomic_width = Some(64);
+ base.crt_static_default = false;
+ base.static_position_independent_executables = true;
+ base.need_rpath = true;
+
+ Ok(Target {
+ llvm_target: "powerpc64le-alpine-linux-musl".to_string(),
+ target_endian: "little".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: "alpine".to_string(),
+ linker_flavor: LinkerFlavor::Gcc,
+ options: TargetOptions {
+ target_mcount: "_mcount".to_string(),
+ .. base
+ },
+ })
+}
|