From 748a089acdfc17d2837cd8ae3a18f577f2f764b7 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Fri, 27 Aug 2021 19:36:18 +0300 Subject: [PATCH] Disallow the aapcs CC on Aarch64 This never really worked and makes LLVM assert. --- compiler/rustc_target/src/spec/mod.rs | 3 +- src/test/ui/abi/unsupported.aarch64.stderr | 24 +++++---- src/test/ui/abi/unsupported.arm.stderr | 58 ++++++++++++++++++++++ src/test/ui/abi/unsupported.i686.stderr | 12 ++--- src/test/ui/abi/unsupported.rs | 16 ++++-- src/test/ui/abi/unsupported.x64.stderr | 16 +++--- 6 files changed, 101 insertions(+), 28 deletions(-) create mode 100644 src/test/ui/abi/unsupported.arm.stderr diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 911956859b861..4d0cad80764e9 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1501,7 +1501,8 @@ impl Target { | Cdecl | EfiApi => true, X86Interrupt => ["x86", "x86_64"].contains(&&self.arch[..]), - Aapcs | CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]), + Aapcs => "arm" == self.arch, + CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]), Win64 | SysV64 => self.arch == "x86_64", PtxKernel => self.arch == "nvptx64", Msp430Interrupt => self.arch == "msp430", diff --git a/src/test/ui/abi/unsupported.aarch64.stderr b/src/test/ui/abi/unsupported.aarch64.stderr index fdeb79f93e9f2..225d49e05a3fa 100644 --- a/src/test/ui/abi/unsupported.aarch64.stderr +++ b/src/test/ui/abi/unsupported.aarch64.stderr @@ -1,41 +1,47 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:24:1 + --> $DIR/unsupported.rs:26:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:26:1 + --> $DIR/unsupported.rs:28:1 | LL | extern "amdgpu-kernel" fn amdgpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"wasm"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:28:1 + --> $DIR/unsupported.rs:30:1 | LL | extern "wasm" fn wasm() {} | ^^^^^^^^^^^^^^^^^^^^^^^ +error[E0570]: `"aapcs"` is not a supported ABI for the current target + --> $DIR/unsupported.rs:32:1 + | +LL | extern "aapcs" fn aapcs() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:33:1 + --> $DIR/unsupported.rs:36:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:35:1 + --> $DIR/unsupported.rs:38:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:37:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of calling convention not supported on this target - --> $DIR/unsupported.rs:39:1 + --> $DIR/unsupported.rs:43:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -45,7 +51,7 @@ LL | extern "stdcall" fn stdcall() {} = note: for more information, see issue #87678 warning: use of calling convention not supported on this target - --> $DIR/unsupported.rs:44:1 + --> $DIR/unsupported.rs:50:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -53,6 +59,6 @@ LL | extern "thiscall" fn thiscall() {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 -error: aborting due to 6 previous errors; 2 warnings emitted +error: aborting due to 7 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0570`. diff --git a/src/test/ui/abi/unsupported.arm.stderr b/src/test/ui/abi/unsupported.arm.stderr new file mode 100644 index 0000000000000..b050ee0aa3148 --- /dev/null +++ b/src/test/ui/abi/unsupported.arm.stderr @@ -0,0 +1,58 @@ +error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target + --> $DIR/unsupported.rs:26:1 + | +LL | extern "ptx-kernel" fn ptx() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target + --> $DIR/unsupported.rs:28:1 + | +LL | extern "amdgpu-kernel" fn amdgpu() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0570]: `"wasm"` is not a supported ABI for the current target + --> $DIR/unsupported.rs:30:1 + | +LL | extern "wasm" fn wasm() {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target + --> $DIR/unsupported.rs:36:1 + | +LL | extern "msp430-interrupt" fn msp430() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target + --> $DIR/unsupported.rs:38:1 + | +LL | extern "avr-interrupt" fn avr() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target + --> $DIR/unsupported.rs:40:1 + | +LL | extern "x86-interrupt" fn x86() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: use of calling convention not supported on this target + --> $DIR/unsupported.rs:43:1 + | +LL | extern "stdcall" fn stdcall() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unsupported_calling_conventions)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #87678 + +warning: use of calling convention not supported on this target + --> $DIR/unsupported.rs:50:1 + | +LL | extern "thiscall" fn thiscall() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #87678 + +error: aborting due to 6 previous errors; 2 warnings emitted + +For more information about this error, try `rustc --explain E0570`. diff --git a/src/test/ui/abi/unsupported.i686.stderr b/src/test/ui/abi/unsupported.i686.stderr index 81b12653d2ee8..7ca93516db989 100644 --- a/src/test/ui/abi/unsupported.i686.stderr +++ b/src/test/ui/abi/unsupported.i686.stderr @@ -1,35 +1,35 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:24:1 + --> $DIR/unsupported.rs:26:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:26:1 + --> $DIR/unsupported.rs:28:1 | LL | extern "amdgpu-kernel" fn amdgpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"wasm"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:28:1 + --> $DIR/unsupported.rs:30:1 | LL | extern "wasm" fn wasm() {} | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:30:1 + --> $DIR/unsupported.rs:32:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:33:1 + --> $DIR/unsupported.rs:36:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:35:1 + --> $DIR/unsupported.rs:38:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/abi/unsupported.rs b/src/test/ui/abi/unsupported.rs index f0debdcf621e2..9319eac8d30d8 100644 --- a/src/test/ui/abi/unsupported.rs +++ b/src/test/ui/abi/unsupported.rs @@ -1,11 +1,13 @@ -// revisions: x64 i686 aarch64 +// revisions: x64 i686 aarch64 arm // // [x64] needs-llvm-components: x86 -// [x64]compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib +// [x64] compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib // [i686] needs-llvm-components: x86 -// [i686]compile-flags: --target=i686-unknown-linux-gnu --crate-type=rlib +// [i686] compile-flags: --target=i686-unknown-linux-gnu --crate-type=rlib // [aarch64] needs-llvm-components: aarch64 -// [aarch64]compile-flags: --target=aarch64-unknown-linux-gnu --crate-type=rlib +// [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu --crate-type=rlib +// [arm] needs-llvm-components: arm +// [arm] compile-flags: --target=armv7-unknown-linux-gnueabihf --crate-type=rlib #![no_core] #![feature( no_core, @@ -30,19 +32,25 @@ extern "wasm" fn wasm() {} extern "aapcs" fn aapcs() {} //[x64]~^ ERROR is not a supported ABI //[i686]~^^ ERROR is not a supported ABI +//[aarch64]~^^^ ERROR is not a supported ABI extern "msp430-interrupt" fn msp430() {} //~^ ERROR is not a supported ABI extern "avr-interrupt" fn avr() {} //~^ ERROR is not a supported ABI extern "x86-interrupt" fn x86() {} //[aarch64]~^ ERROR is not a supported ABI +//[arm]~^^ ERROR is not a supported ABI extern "stdcall" fn stdcall() {} //[x64]~^ WARN use of calling convention not supported //[x64]~^^ WARN this was previously accepted //[aarch64]~^^^ WARN use of calling convention not supported //[aarch64]~^^^^ WARN this was previously accepted +//[arm]~^^^^^ WARN use of calling convention not supported +//[arm]~^^^^^^ WARN this was previously accepted extern "thiscall" fn thiscall() {} //[x64]~^ WARN use of calling convention not supported //[x64]~^^ WARN this was previously accepted //[aarch64]~^^^ WARN use of calling convention not supported //[aarch64]~^^^^ WARN this was previously accepted +//[arm]~^^^^^ WARN use of calling convention not supported +//[arm]~^^^^^^ WARN this was previously accepted diff --git a/src/test/ui/abi/unsupported.x64.stderr b/src/test/ui/abi/unsupported.x64.stderr index 60d067acf174f..f2f52683324db 100644 --- a/src/test/ui/abi/unsupported.x64.stderr +++ b/src/test/ui/abi/unsupported.x64.stderr @@ -1,41 +1,41 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:24:1 + --> $DIR/unsupported.rs:26:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"amdgpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:26:1 + --> $DIR/unsupported.rs:28:1 | LL | extern "amdgpu-kernel" fn amdgpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"wasm"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:28:1 + --> $DIR/unsupported.rs:30:1 | LL | extern "wasm" fn wasm() {} | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:30:1 + --> $DIR/unsupported.rs:32:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:33:1 + --> $DIR/unsupported.rs:36:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:35:1 + --> $DIR/unsupported.rs:38:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of calling convention not supported on this target - --> $DIR/unsupported.rs:39:1 + --> $DIR/unsupported.rs:43:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -45,7 +45,7 @@ LL | extern "stdcall" fn stdcall() {} = note: for more information, see issue #87678 warning: use of calling convention not supported on this target - --> $DIR/unsupported.rs:44:1 + --> $DIR/unsupported.rs:50:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^