-
Notifications
You must be signed in to change notification settings - Fork 135
/
0001-add-chimera-targets-always-dynamic-musl-static-pie.patch
201 lines (195 loc) · 8.16 KB
/
0001-add-chimera-targets-always-dynamic-musl-static-pie.patch
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
From a0725b4ad8bb2134b7a4977c99c5785e3b204839 Mon Sep 17 00:00:00 2001
From: q66 <q66@chimera-linux.org>
Date: Thu, 4 Jan 2024 14:53:26 +0100
Subject: [PATCH 01/14] add chimera targets, always dynamic musl + static pie
---
compiler/rustc_target/src/spec/base/linux_musl.rs | 14 ++++++++------
compiler/rustc_target/src/spec/mod.rs | 8 ++++++++
.../src/spec/targets/aarch64_chimera_linux_musl.rs | 10 ++++++++++
.../spec/targets/arm_chimera_linux_musleabihf.rs | 10 ++++++++++
.../spec/targets/armv7_chimera_linux_musleabihf.rs | 10 ++++++++++
.../spec/targets/powerpc64_chimera_linux_musl.rs | 10 ++++++++++
.../spec/targets/powerpc64le_chimera_linux_musl.rs | 10 ++++++++++
.../src/spec/targets/powerpc_chimera_linux_musl.rs | 10 ++++++++++
.../src/spec/targets/riscv64_chimera_linux_musl.rs | 10 ++++++++++
.../src/spec/targets/x86_64_chimera_linux_musl.rs | 10 ++++++++++
10 files changed, 96 insertions(+), 6 deletions(-)
create mode 100644 compiler/rustc_target/src/spec/targets/aarch64_chimera_linux_musl.rs
create mode 100644 compiler/rustc_target/src/spec/targets/arm_chimera_linux_musleabihf.rs
create mode 100644 compiler/rustc_target/src/spec/targets/armv7_chimera_linux_musleabihf.rs
create mode 100644 compiler/rustc_target/src/spec/targets/powerpc64_chimera_linux_musl.rs
create mode 100644 compiler/rustc_target/src/spec/targets/powerpc64le_chimera_linux_musl.rs
create mode 100644 compiler/rustc_target/src/spec/targets/powerpc_chimera_linux_musl.rs
create mode 100644 compiler/rustc_target/src/spec/targets/riscv64_chimera_linux_musl.rs
create mode 100644 compiler/rustc_target/src/spec/targets/x86_64_chimera_linux_musl.rs
diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs
index e020bb8523..078cb531d8 100644
--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
+++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
@@ -4,12 +4,14 @@ pub(crate) fn opts() -> TargetOptions {
let mut base = base::linux::opts();
base.env = "musl".into();
- base.pre_link_objects_self_contained = crt_objects::pre_musl_self_contained();
- base.post_link_objects_self_contained = crt_objects::post_musl_self_contained();
- base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
-
- // These targets statically link libc by default
- base.crt_static_default = true;
+ // use dynamic musl by default
+ base.crt_static_default = false;
+ // use static pie by default
+ base.static_position_independent_executables = true;
+ // we want to link to default libraries in order to reliably
+ // get in the builtins; this will also link in libc, which
+ // we likewise want (and avoid hacks in the libc module)
+ base.no_default_libraries = false;
base
}
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 82e11a3afc..a0be8d788c 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1618,6 +1618,14 @@ macro_rules! supported_targets {
}
supported_targets! {
+ ("x86_64-chimera-linux-musl", x86_64_chimera_linux_musl),
+ ("arm-chimera-linux-musleabihf", arm_chimera_linux_musleabihf),
+ ("armv7-chimera-linux-musleabihf", armv7_chimera_linux_musleabihf),
+ ("aarch64-chimera-linux-musl", aarch64_chimera_linux_musl),
+ ("powerpc-chimera-linux-musl", powerpc_chimera_linux_musl),
+ ("powerpc64-chimera-linux-musl", powerpc64_chimera_linux_musl),
+ ("powerpc64le-chimera-linux-musl", powerpc64le_chimera_linux_musl),
+ ("riscv64-chimera-linux-musl", riscv64_chimera_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_chimera_linux_musl.rs b/compiler/rustc_target/src/spec/targets/aarch64_chimera_linux_musl.rs
new file mode 100644
index 0000000000..ff2c140aa5
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/aarch64_chimera_linux_musl.rs
@@ -0,0 +1,10 @@
+use crate::spec::Target;
+
+pub fn target() -> Target {
+ let mut base = super::aarch64_unknown_linux_musl::target();
+
+ base.llvm_target = "aarch64-chimera-linux-musl".into();
+ base.options.vendor = "chimera".into();
+
+ base
+}
diff --git a/compiler/rustc_target/src/spec/targets/arm_chimera_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_chimera_linux_musleabihf.rs
new file mode 100644
index 0000000000..2a96971af1
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/arm_chimera_linux_musleabihf.rs
@@ -0,0 +1,10 @@
+use crate::spec::Target;
+
+pub fn target() -> Target {
+ let mut base = super::arm_unknown_linux_musleabihf::target();
+
+ base.llvm_target = "arm-chimera-linux-musleabihf".into();
+ base.options.vendor = "chimera".into();
+
+ base
+}
diff --git a/compiler/rustc_target/src/spec/targets/armv7_chimera_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_chimera_linux_musleabihf.rs
new file mode 100644
index 0000000000..8f44b8ec51
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/armv7_chimera_linux_musleabihf.rs
@@ -0,0 +1,10 @@
+use crate::spec::Target;
+
+pub fn target() -> Target {
+ let mut base = super::armv7_unknown_linux_musleabihf::target();
+
+ base.llvm_target = "armv7-chimera-linux-musleabihf".into();
+ base.options.vendor = "chimera".into();
+
+ base
+}
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_chimera_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_chimera_linux_musl.rs
new file mode 100644
index 0000000000..5953e15654
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_chimera_linux_musl.rs
@@ -0,0 +1,10 @@
+use crate::spec::Target;
+
+pub fn target() -> Target {
+ let mut base = super::powerpc64_unknown_linux_musl::target();
+
+ base.llvm_target = "powerpc64-chimera-linux-musl".into();
+ base.options.vendor = "chimera".into();
+
+ base
+}
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_chimera_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_chimera_linux_musl.rs
new file mode 100644
index 0000000000..29a7459b7a
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_chimera_linux_musl.rs
@@ -0,0 +1,10 @@
+use crate::spec::Target;
+
+pub fn target() -> Target {
+ let mut base = super::powerpc64le_unknown_linux_musl::target();
+
+ base.llvm_target = "powerpc64le-chimera-linux-musl".into();
+ base.options.vendor = "chimera".into();
+
+ base
+}
diff --git a/compiler/rustc_target/src/spec/targets/powerpc_chimera_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc_chimera_linux_musl.rs
new file mode 100644
index 0000000000..65b2d62ba0
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/powerpc_chimera_linux_musl.rs
@@ -0,0 +1,10 @@
+use crate::spec::Target;
+
+pub fn target() -> Target {
+ let mut base = super::powerpc_unknown_linux_musl::target();
+
+ base.llvm_target = "powerpc-chimera-linux-musl".into();
+ base.options.vendor = "chimera".into();
+
+ base
+}
diff --git a/compiler/rustc_target/src/spec/targets/riscv64_chimera_linux_musl.rs b/compiler/rustc_target/src/spec/targets/riscv64_chimera_linux_musl.rs
new file mode 100644
index 0000000000..8c26403ce8
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/riscv64_chimera_linux_musl.rs
@@ -0,0 +1,10 @@
+use crate::spec::Target;
+
+pub fn target() -> Target {
+ let mut base = super::riscv64gc_unknown_linux_musl::target();
+
+ base.llvm_target = "riscv64-chimera-linux-musl".into();
+ base.options.vendor = "chimera".into();
+
+ base
+}
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_chimera_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_chimera_linux_musl.rs
new file mode 100644
index 0000000000..9a94dd228a
--- /dev/null
+++ b/compiler/rustc_target/src/spec/targets/x86_64_chimera_linux_musl.rs
@@ -0,0 +1,10 @@
+use crate::spec::Target;
+
+pub fn target() -> Target {
+ let mut base = super::x86_64_unknown_linux_musl::target();
+
+ base.llvm_target = "x86_64-chimera-linux-musl".into();
+ base.options.vendor = "chimera".into();
+
+ base
+}
--
2.47.0