@@ -11,6 +11,8 @@ pub enum Arch {
1111 X86_64 ,
1212 /// AArch64
1313 Aarch64 ,
14+ /// AArch64, big-endian
15+ Aarch64Be ,
1416 /// 64-bit RISC-V
1517 Riscv64 ,
1618}
@@ -21,6 +23,10 @@ impl Arch {
2123 }
2224
2325 pub fn install ( & self ) -> Result < ( ) > {
26+ if self . tier ( ) > 2 {
27+ return Ok ( ( ) ) ;
28+ }
29+
2430 let mut rustup = crate :: rustup ( ) ;
2531 rustup. args ( [ "target" , "add" , self . triple ( ) ] ) ;
2632
@@ -42,14 +48,23 @@ impl Arch {
4248 match self {
4349 Self :: X86_64 => "x86_64" ,
4450 Self :: Aarch64 => "aarch64" ,
51+ Self :: Aarch64Be => "aarch64_be" ,
4552 Self :: Riscv64 => "riscv64" ,
4653 }
4754 }
4855
56+ pub fn tier ( & self ) -> u8 {
57+ match self {
58+ Self :: Aarch64Be => 3 ,
59+ _ => 2 ,
60+ }
61+ }
62+
4963 pub fn triple ( & self ) -> & ' static str {
5064 match self {
5165 Self :: X86_64 => "x86_64-unknown-none" ,
5266 Self :: Aarch64 => "aarch64-unknown-none-softfloat" ,
67+ Self :: Aarch64Be => "aarch64_be-unknown-none-softfloat" ,
5368 Self :: Riscv64 => "riscv64gc-unknown-none-elf" ,
5469 }
5570 }
@@ -58,6 +73,7 @@ impl Arch {
5873 match self {
5974 Self :: X86_64 => "x86_64-unknown-hermit" ,
6075 Self :: Aarch64 => "aarch64-unknown-hermit" ,
76+ Self :: Aarch64Be => "aarch64_be-unknown-hermit" ,
6177 Self :: Riscv64 => "riscv64gc-unknown-hermit" ,
6278 }
6379 }
@@ -74,6 +90,11 @@ impl Arch {
7490 "-Zbuild-std=core" ,
7591 "-Zbuild-std-features=compiler-builtins-mem" ,
7692 ] ,
93+ Self :: Aarch64Be => & [
94+ "--target=aarch64_be-unknown-hermit" ,
95+ "-Zbuild-std=core" ,
96+ "-Zbuild-std-features=compiler-builtins-mem" ,
97+ ] ,
7798 Arch :: Riscv64 => & [
7899 "--target=riscv64gc-unknown-hermit" ,
79100 "-Zbuild-std=core" ,
@@ -92,6 +113,13 @@ impl Arch {
92113 "-Zbuild-std=core,alloc" ,
93114 "-Zbuild-std-features=compiler-builtins-mem" ,
94115 ] ,
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+ ] ,
95123 Self :: Riscv64 => & [
96124 "--target=riscv64gc-unknown-none-elf" ,
97125 // We can't use prebuilt std here because it is built with
@@ -112,6 +140,10 @@ impl Arch {
112140 "--target=aarch64-unknown-hermit" ,
113141 "-Zbuild-std=std,panic_abort" ,
114142 ] ,
143+ Self :: Aarch64Be => & [
144+ "--target=aarch64_be-unknown-hermit" ,
145+ "-Zbuild-std=std,panic_abort" ,
146+ ] ,
115147 Arch :: Riscv64 => & [
116148 "--target=riscv64gc-unknown-hermit" ,
117149 "-Zbuild-std=std,panic_abort" ,
@@ -122,10 +154,18 @@ impl Arch {
122154 pub fn rustflags ( & self ) -> & ' static [ & ' static str ] {
123155 match self {
124156 Self :: X86_64 => & [ ] ,
125- Self :: Aarch64 => & [ "-Crelocation-model=pic" ] ,
157+ Self :: Aarch64 | Self :: Aarch64Be => & [ "-Crelocation-model=pic" ] ,
126158 Self :: Riscv64 => & [ "-Cno-redzone" , "-Crelocation-model=pic" ] ,
127159 }
128160 }
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+ }
129169}
130170
131171impl fmt:: Display for Arch {
0 commit comments