@@ -11,6 +11,8 @@ pub enum Arch {
11
11
X86_64 ,
12
12
/// AArch64
13
13
Aarch64 ,
14
+ /// AArch64, big-endian
15
+ Aarch64Be ,
14
16
/// 64-bit RISC-V
15
17
Riscv64 ,
16
18
}
@@ -21,6 +23,10 @@ impl Arch {
21
23
}
22
24
23
25
pub fn install ( & self ) -> Result < ( ) > {
26
+ if self . tier ( ) > 2 {
27
+ return Ok ( ( ) ) ;
28
+ }
29
+
24
30
let mut rustup = crate :: rustup ( ) ;
25
31
rustup. args ( [ "target" , "add" , self . triple ( ) ] ) ;
26
32
@@ -42,14 +48,23 @@ impl Arch {
42
48
match self {
43
49
Self :: X86_64 => "x86_64" ,
44
50
Self :: Aarch64 => "aarch64" ,
51
+ Self :: Aarch64Be => "aarch64_be" ,
45
52
Self :: Riscv64 => "riscv64" ,
46
53
}
47
54
}
48
55
56
+ pub fn tier ( & self ) -> u8 {
57
+ match self {
58
+ Self :: Aarch64Be => 3 ,
59
+ _ => 2 ,
60
+ }
61
+ }
62
+
49
63
pub fn triple ( & self ) -> & ' static str {
50
64
match self {
51
65
Self :: X86_64 => "x86_64-unknown-none" ,
52
66
Self :: Aarch64 => "aarch64-unknown-none-softfloat" ,
67
+ Self :: Aarch64Be => "aarch64_be-unknown-none-softfloat" ,
53
68
Self :: Riscv64 => "riscv64gc-unknown-none-elf" ,
54
69
}
55
70
}
@@ -58,6 +73,7 @@ impl Arch {
58
73
match self {
59
74
Self :: X86_64 => "x86_64-unknown-hermit" ,
60
75
Self :: Aarch64 => "aarch64-unknown-hermit" ,
76
+ Self :: Aarch64Be => "aarch64_be-unknown-hermit" ,
61
77
Self :: Riscv64 => "riscv64gc-unknown-hermit" ,
62
78
}
63
79
}
@@ -74,6 +90,11 @@ impl Arch {
74
90
"-Zbuild-std=core" ,
75
91
"-Zbuild-std-features=compiler-builtins-mem" ,
76
92
] ,
93
+ Self :: Aarch64Be => & [
94
+ "--target=aarch64_be-unknown-hermit" ,
95
+ "-Zbuild-std=core" ,
96
+ "-Zbuild-std-features=compiler-builtins-mem" ,
97
+ ] ,
77
98
Arch :: Riscv64 => & [
78
99
"--target=riscv64gc-unknown-hermit" ,
79
100
"-Zbuild-std=core" ,
@@ -92,6 +113,13 @@ impl Arch {
92
113
"-Zbuild-std=core,alloc" ,
93
114
"-Zbuild-std-features=compiler-builtins-mem" ,
94
115
] ,
116
+ Self :: Aarch64Be => & [
117
+ "--target=aarch64_be-unknown-none-softfloat" ,
118
+ // We can't use prebuilt std here because it is built with
119
+ // relocation-model=static and we need relocation-model=pic
120
+ "-Zbuild-std=core,alloc" ,
121
+ "-Zbuild-std-features=compiler-builtins-mem" ,
122
+ ] ,
95
123
Self :: Riscv64 => & [
96
124
"--target=riscv64gc-unknown-none-elf" ,
97
125
// We can't use prebuilt std here because it is built with
@@ -112,6 +140,10 @@ impl Arch {
112
140
"--target=aarch64-unknown-hermit" ,
113
141
"-Zbuild-std=std,panic_abort" ,
114
142
] ,
143
+ Self :: Aarch64Be => & [
144
+ "--target=aarch64_be-unknown-hermit" ,
145
+ "-Zbuild-std=std,panic_abort" ,
146
+ ] ,
115
147
Arch :: Riscv64 => & [
116
148
"--target=riscv64gc-unknown-hermit" ,
117
149
"-Zbuild-std=std,panic_abort" ,
@@ -122,10 +154,18 @@ impl Arch {
122
154
pub fn rustflags ( & self ) -> & ' static [ & ' static str ] {
123
155
match self {
124
156
Self :: X86_64 => & [ ] ,
125
- Self :: Aarch64 => & [ "-Crelocation-model=pic" ] ,
157
+ Self :: Aarch64 | Self :: Aarch64Be => & [ "-Crelocation-model=pic" ] ,
126
158
Self :: Riscv64 => & [ "-Cno-redzone" , "-Crelocation-model=pic" ] ,
127
159
}
128
160
}
161
+
162
+ pub fn qemu ( & self ) -> & ' static str {
163
+ match self {
164
+ Self :: X86_64 => "x86_64" ,
165
+ Self :: Aarch64 | Self :: Aarch64Be => "aarch64" ,
166
+ Self :: Riscv64 => "riscv64" ,
167
+ }
168
+ }
129
169
}
130
170
131
171
impl fmt:: Display for Arch {
0 commit comments