-
Notifications
You must be signed in to change notification settings - Fork 3
/
0004-Add-some-Xtensa-targets.patch
256 lines (251 loc) · 9.02 KB
/
0004-Add-some-Xtensa-targets.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
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
252
253
254
255
From 0e8aacc3611ac6c82ce95ced38e9d8451daef199 Mon Sep 17 00:00:00 2001
From: Scott Mabin <scott@mabez.dev>
Date: Sat, 12 Sep 2020 23:36:21 +0100
Subject: [PATCH 4/5] Add some Xtensa targets
ESP32, ESP32s2, ESP8266 and a generic Xtensa target.
---
compiler/rustc_target/src/spec/mod.rs | 5 ++
.../src/spec/xtensa_esp32_none_elf.rs | 48 +++++++++++++++++++
.../src/spec/xtensa_esp32s2_none_elf.rs | 48 +++++++++++++++++++
.../src/spec/xtensa_esp8266_none_elf.rs | 48 +++++++++++++++++++
.../rustc_target/src/spec/xtensa_none_elf.rs | 47 ++++++++++++++++++
5 files changed, 196 insertions(+)
create mode 100644 compiler/rustc_target/src/spec/xtensa_esp32_none_elf.rs
create mode 100644 compiler/rustc_target/src/spec/xtensa_esp32s2_none_elf.rs
create mode 100644 compiler/rustc_target/src/spec/xtensa_esp8266_none_elf.rs
create mode 100644 compiler/rustc_target/src/spec/xtensa_none_elf.rs
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index 7a93bac72ca..71e9b09a397 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -797,6 +797,11 @@ fn to_json(&self) -> Json {
("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),
+ ("xtensa-esp32-none-elf", xtensa_esp32_none_elf),
+ ("xtensa-esp32s2-none-elf", xtensa_esp32s2_none_elf),
+ ("xtensa-esp8266-none-elf", xtensa_esp8266_none_elf),
+ ("xtensa-none-elf", xtensa_none_elf),
+
("i686-wrs-vxworks", i686_wrs_vxworks),
("x86_64-wrs-vxworks", x86_64_wrs_vxworks),
("armv7-wrs-vxworks-eabihf", armv7_wrs_vxworks_eabihf),
diff --git a/compiler/rustc_target/src/spec/xtensa_esp32_none_elf.rs b/compiler/rustc_target/src/spec/xtensa_esp32_none_elf.rs
new file mode 100644
index 00000000000..1397dd62a3b
--- /dev/null
+++ b/compiler/rustc_target/src/spec/xtensa_esp32_none_elf.rs
@@ -0,0 +1,48 @@
+use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, RelocModel};
+use crate::abi::Endian;
+
+pub fn target() -> Target {
+ Target {
+ llvm_target: "xtensa-none-elf".to_string(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32".to_string(),
+ arch: "xtensa".to_string(),
+
+ options: TargetOptions {
+ endian: Endian::Little,
+ c_int_width: "32".to_string(),
+ os: "none".to_string(),
+ env: String::new(),
+ vendor: String::new(),
+ linker_flavor: LinkerFlavor::Gcc,
+
+ executables: true,
+ cpu: "esp32".to_string(),
+ linker: Some("xtensa-esp32-elf-gcc".to_string()),
+
+ max_atomic_width: Some(32),
+
+ // Because these devices have very little resources having an
+ // unwinder is too onerous so we default to "abort" because the
+ // "unwind" strategy is very rare.
+ panic_strategy: PanicStrategy::Abort,
+
+ // Similarly, one almost always never wants to use relocatable
+ // code because of the extra costs it involves.
+ relocation_model: RelocModel::Static,
+
+ emit_debug_gdb_scripts: false,
+
+ unsupported_abis: vec![
+ Abi::Stdcall,
+ Abi::Fastcall,
+ Abi::Vectorcall,
+ Abi::Thiscall,
+ Abi::Win64,
+ Abi::SysV64,
+ ],
+
+ ..Default::default()
+ },
+ }
+}
\ No newline at end of file
diff --git a/compiler/rustc_target/src/spec/xtensa_esp32s2_none_elf.rs b/compiler/rustc_target/src/spec/xtensa_esp32s2_none_elf.rs
new file mode 100644
index 00000000000..54820dcbce0
--- /dev/null
+++ b/compiler/rustc_target/src/spec/xtensa_esp32s2_none_elf.rs
@@ -0,0 +1,48 @@
+use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, RelocModel};
+use crate::abi::Endian;
+
+pub fn target() -> Target {
+ Target {
+ llvm_target: "xtensa-none-elf".to_string(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32".to_string(),
+ arch: "xtensa".to_string(),
+
+ options: TargetOptions {
+ endian: Endian::Little,
+ c_int_width: "32".to_string(),
+ os: "none".to_string(),
+ env: String::new(),
+ vendor: String::new(),
+ linker_flavor: LinkerFlavor::Gcc,
+
+ executables: true,
+ cpu: "esp32-s2".to_string(),
+ linker: Some("xtensa-esp32s2-elf-gcc".to_string()),
+
+ max_atomic_width: Some(32),
+
+ // Because these devices have very little resources having an
+ // unwinder is too onerous so we default to "abort" because the
+ // "unwind" strategy is very rare.
+ panic_strategy: PanicStrategy::Abort,
+
+ // Similarly, one almost always never wants to use relocatable
+ // code because of the extra costs it involves.
+ relocation_model: RelocModel::Static,
+
+ emit_debug_gdb_scripts: false,
+
+ unsupported_abis: vec![
+ Abi::Stdcall,
+ Abi::Fastcall,
+ Abi::Vectorcall,
+ Abi::Thiscall,
+ Abi::Win64,
+ Abi::SysV64,
+ ],
+
+ ..Default::default()
+ },
+ }
+}
\ No newline at end of file
diff --git a/compiler/rustc_target/src/spec/xtensa_esp8266_none_elf.rs b/compiler/rustc_target/src/spec/xtensa_esp8266_none_elf.rs
new file mode 100644
index 00000000000..de0424404d0
--- /dev/null
+++ b/compiler/rustc_target/src/spec/xtensa_esp8266_none_elf.rs
@@ -0,0 +1,48 @@
+use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, RelocModel};
+use crate::abi::Endian;
+
+pub fn target() -> Target {
+ Target {
+ llvm_target: "xtensa-none-elf".to_string(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32".to_string(),
+ arch: "xtensa".to_string(),
+
+ options: TargetOptions {
+ endian: Endian::Little,
+ c_int_width: "32".to_string(),
+ os: "none".to_string(),
+ env: String::new(),
+ vendor: String::new(),
+ linker_flavor: LinkerFlavor::Gcc,
+
+ executables: true,
+ cpu: "esp8266".to_string(),
+ linker: Some("xtensa-lx106-elf-gcc".to_string()),
+
+ max_atomic_width: Some(32),
+
+ // Because these devices have very little resources having an
+ // unwinder is too onerous so we default to "abort" because the
+ // "unwind" strategy is very rare.
+ panic_strategy: PanicStrategy::Abort,
+
+ // Similarly, one almost always never wants to use relocatable
+ // code because of the extra costs it involves.
+ relocation_model: RelocModel::Static,
+
+ emit_debug_gdb_scripts: false,
+
+ unsupported_abis: vec![
+ Abi::Stdcall,
+ Abi::Fastcall,
+ Abi::Vectorcall,
+ Abi::Thiscall,
+ Abi::Win64,
+ Abi::SysV64,
+ ],
+
+ ..Default::default()
+ },
+ }
+}
\ No newline at end of file
diff --git a/compiler/rustc_target/src/spec/xtensa_none_elf.rs b/compiler/rustc_target/src/spec/xtensa_none_elf.rs
new file mode 100644
index 00000000000..2fbe42b07f3
--- /dev/null
+++ b/compiler/rustc_target/src/spec/xtensa_none_elf.rs
@@ -0,0 +1,47 @@
+use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, RelocModel};
+use crate::abi::Endian;
+
+pub fn target() -> Target {
+ Target {
+ llvm_target: "xtensa-none-elf".to_string(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32".to_string(),
+ arch: "xtensa".to_string(),
+
+ options: TargetOptions {
+ endian: Endian::Little,
+ c_int_width: "32".to_string(),
+ os: "none".to_string(),
+ env: String::new(),
+ vendor: String::new(),
+ linker_flavor: LinkerFlavor::Gcc,
+
+ executables: true,
+ linker: Some("xtensa-esp32-elf-gcc".to_string()),
+
+ max_atomic_width: Some(32),
+
+ // Because these devices have very little resources having an
+ // unwinder is too onerous so we default to "abort" because the
+ // "unwind" strategy is very rare.
+ panic_strategy: PanicStrategy::Abort,
+
+ // Similarly, one almost always never wants to use relocatable
+ // code because of the extra costs it involves.
+ relocation_model: RelocModel::Static,
+
+ emit_debug_gdb_scripts: false,
+
+ unsupported_abis: vec![
+ Abi::Stdcall,
+ Abi::Fastcall,
+ Abi::Vectorcall,
+ Abi::Thiscall,
+ Abi::Win64,
+ Abi::SysV64,
+ ],
+
+ ..Default::default()
+ },
+ }
+}
\ No newline at end of file
--
2.26.3