Skip to content

Commit 4d08908

Browse files
authored
Rollup merge of #88399 - nagisa:nagisa/aapcs-on-aarch, r=petrochenkov
Disallow the aapcs CC on Aarch64 This never really worked and makes LLVM assert.
2 parents f4f5dd5 + 748a089 commit 4d08908

File tree

6 files changed

+101
-28
lines changed

6 files changed

+101
-28
lines changed

compiler/rustc_target/src/spec/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,8 @@ impl Target {
15011501
| Cdecl
15021502
| EfiApi => true,
15031503
X86Interrupt => ["x86", "x86_64"].contains(&&self.arch[..]),
1504-
Aapcs | CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]),
1504+
Aapcs => "arm" == self.arch,
1505+
CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]),
15051506
Win64 | SysV64 => self.arch == "x86_64",
15061507
PtxKernel => self.arch == "nvptx64",
15071508
Msp430Interrupt => self.arch == "msp430",
+15-9
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:24:1
2+
--> $DIR/unsupported.rs:26:1
33
|
44
LL | extern "ptx-kernel" fn ptx() {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:26:1
8+
--> $DIR/unsupported.rs:28:1
99
|
1010
LL | extern "amdgpu-kernel" fn amdgpu() {}
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error[E0570]: `"wasm"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:28:1
14+
--> $DIR/unsupported.rs:30:1
1515
|
1616
LL | extern "wasm" fn wasm() {}
1717
| ^^^^^^^^^^^^^^^^^^^^^^^
1818

19+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:32:1
21+
|
22+
LL | extern "aapcs" fn aapcs() {}
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
24+
1925
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:33:1
26+
--> $DIR/unsupported.rs:36:1
2127
|
2228
LL | extern "msp430-interrupt" fn msp430() {}
2329
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2430

2531
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:35:1
32+
--> $DIR/unsupported.rs:38:1
2733
|
2834
LL | extern "avr-interrupt" fn avr() {}
2935
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3036

3137
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
32-
--> $DIR/unsupported.rs:37:1
38+
--> $DIR/unsupported.rs:40:1
3339
|
3440
LL | extern "x86-interrupt" fn x86() {}
3541
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3642

3743
warning: use of calling convention not supported on this target
38-
--> $DIR/unsupported.rs:39:1
44+
--> $DIR/unsupported.rs:43:1
3945
|
4046
LL | extern "stdcall" fn stdcall() {}
4147
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,14 +51,14 @@ LL | extern "stdcall" fn stdcall() {}
4551
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
4652

4753
warning: use of calling convention not supported on this target
48-
--> $DIR/unsupported.rs:44:1
54+
--> $DIR/unsupported.rs:50:1
4955
|
5056
LL | extern "thiscall" fn thiscall() {}
5157
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5258
|
5359
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5460
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
5561

56-
error: aborting due to 6 previous errors; 2 warnings emitted
62+
error: aborting due to 7 previous errors; 2 warnings emitted
5763

5864
For more information about this error, try `rustc --explain E0570`.
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2+
--> $DIR/unsupported.rs:26:1
3+
|
4+
LL | extern "ptx-kernel" fn ptx() {}
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
8+
--> $DIR/unsupported.rs:28:1
9+
|
10+
LL | extern "amdgpu-kernel" fn amdgpu() {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error[E0570]: `"wasm"` is not a supported ABI for the current target
14+
--> $DIR/unsupported.rs:30:1
15+
|
16+
LL | extern "wasm" fn wasm() {}
17+
| ^^^^^^^^^^^^^^^^^^^^^^^
18+
19+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:36:1
21+
|
22+
LL | extern "msp430-interrupt" fn msp430() {}
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
26+
--> $DIR/unsupported.rs:38:1
27+
|
28+
LL | extern "avr-interrupt" fn avr() {}
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
32+
--> $DIR/unsupported.rs:40:1
33+
|
34+
LL | extern "x86-interrupt" fn x86() {}
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
warning: use of calling convention not supported on this target
38+
--> $DIR/unsupported.rs:43:1
39+
|
40+
LL | extern "stdcall" fn stdcall() {}
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
|
43+
= note: `#[warn(unsupported_calling_conventions)]` on by default
44+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
45+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
46+
47+
warning: use of calling convention not supported on this target
48+
--> $DIR/unsupported.rs:50:1
49+
|
50+
LL | extern "thiscall" fn thiscall() {}
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52+
|
53+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
54+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
55+
56+
error: aborting due to 6 previous errors; 2 warnings emitted
57+
58+
For more information about this error, try `rustc --explain E0570`.

src/test/ui/abi/unsupported.i686.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:24:1
2+
--> $DIR/unsupported.rs:26:1
33
|
44
LL | extern "ptx-kernel" fn ptx() {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:26:1
8+
--> $DIR/unsupported.rs:28:1
99
|
1010
LL | extern "amdgpu-kernel" fn amdgpu() {}
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error[E0570]: `"wasm"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:28:1
14+
--> $DIR/unsupported.rs:30:1
1515
|
1616
LL | extern "wasm" fn wasm() {}
1717
| ^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error[E0570]: `"aapcs"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:30:1
20+
--> $DIR/unsupported.rs:32:1
2121
|
2222
LL | extern "aapcs" fn aapcs() {}
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:33:1
26+
--> $DIR/unsupported.rs:36:1
2727
|
2828
LL | extern "msp430-interrupt" fn msp430() {}
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3030

3131
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
32-
--> $DIR/unsupported.rs:35:1
32+
--> $DIR/unsupported.rs:38:1
3333
|
3434
LL | extern "avr-interrupt" fn avr() {}
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/abi/unsupported.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
// revisions: x64 i686 aarch64
1+
// revisions: x64 i686 aarch64 arm
22
//
33
// [x64] needs-llvm-components: x86
4-
// [x64]compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib
4+
// [x64] compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib
55
// [i686] needs-llvm-components: x86
6-
// [i686]compile-flags: --target=i686-unknown-linux-gnu --crate-type=rlib
6+
// [i686] compile-flags: --target=i686-unknown-linux-gnu --crate-type=rlib
77
// [aarch64] needs-llvm-components: aarch64
8-
// [aarch64]compile-flags: --target=aarch64-unknown-linux-gnu --crate-type=rlib
8+
// [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu --crate-type=rlib
9+
// [arm] needs-llvm-components: arm
10+
// [arm] compile-flags: --target=armv7-unknown-linux-gnueabihf --crate-type=rlib
911
#![no_core]
1012
#![feature(
1113
no_core,
@@ -30,19 +32,25 @@ extern "wasm" fn wasm() {}
3032
extern "aapcs" fn aapcs() {}
3133
//[x64]~^ ERROR is not a supported ABI
3234
//[i686]~^^ ERROR is not a supported ABI
35+
//[aarch64]~^^^ ERROR is not a supported ABI
3336
extern "msp430-interrupt" fn msp430() {}
3437
//~^ ERROR is not a supported ABI
3538
extern "avr-interrupt" fn avr() {}
3639
//~^ ERROR is not a supported ABI
3740
extern "x86-interrupt" fn x86() {}
3841
//[aarch64]~^ ERROR is not a supported ABI
42+
//[arm]~^^ ERROR is not a supported ABI
3943
extern "stdcall" fn stdcall() {}
4044
//[x64]~^ WARN use of calling convention not supported
4145
//[x64]~^^ WARN this was previously accepted
4246
//[aarch64]~^^^ WARN use of calling convention not supported
4347
//[aarch64]~^^^^ WARN this was previously accepted
48+
//[arm]~^^^^^ WARN use of calling convention not supported
49+
//[arm]~^^^^^^ WARN this was previously accepted
4450
extern "thiscall" fn thiscall() {}
4551
//[x64]~^ WARN use of calling convention not supported
4652
//[x64]~^^ WARN this was previously accepted
4753
//[aarch64]~^^^ WARN use of calling convention not supported
4854
//[aarch64]~^^^^ WARN this was previously accepted
55+
//[arm]~^^^^^ WARN use of calling convention not supported
56+
//[arm]~^^^^^^ WARN this was previously accepted

src/test/ui/abi/unsupported.x64.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:24:1
2+
--> $DIR/unsupported.rs:26:1
33
|
44
LL | extern "ptx-kernel" fn ptx() {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:26:1
8+
--> $DIR/unsupported.rs:28:1
99
|
1010
LL | extern "amdgpu-kernel" fn amdgpu() {}
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error[E0570]: `"wasm"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:28:1
14+
--> $DIR/unsupported.rs:30:1
1515
|
1616
LL | extern "wasm" fn wasm() {}
1717
| ^^^^^^^^^^^^^^^^^^^^^^^
1818

1919
error[E0570]: `"aapcs"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:30:1
20+
--> $DIR/unsupported.rs:32:1
2121
|
2222
LL | extern "aapcs" fn aapcs() {}
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^
2424

2525
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:33:1
26+
--> $DIR/unsupported.rs:36:1
2727
|
2828
LL | extern "msp430-interrupt" fn msp430() {}
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3030

3131
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
32-
--> $DIR/unsupported.rs:35:1
32+
--> $DIR/unsupported.rs:38:1
3333
|
3434
LL | extern "avr-interrupt" fn avr() {}
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3636

3737
warning: use of calling convention not supported on this target
38-
--> $DIR/unsupported.rs:39:1
38+
--> $DIR/unsupported.rs:43:1
3939
|
4040
LL | extern "stdcall" fn stdcall() {}
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,7 +45,7 @@ LL | extern "stdcall" fn stdcall() {}
4545
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
4646

4747
warning: use of calling convention not supported on this target
48-
--> $DIR/unsupported.rs:44:1
48+
--> $DIR/unsupported.rs:50:1
4949
|
5050
LL | extern "thiscall" fn thiscall() {}
5151
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)