Skip to content

AAPCS ABI is accepted for x86 target #57182

Closed
@nagisa

Description

@nagisa

Currently the following code compiles fine when targetting x86_64.

pub extern "aapcs" fn  foo() {}

This code is non-sensical because AAPCS calling convention is only defined for ARM. An example of non-sensical ABI being disallowed is

pub extern "fastcall" fn  foo() {}

when compiling with --target=armv7-unknown-linux-gnueabihf which fails with:

error[E0570]: The ABI `"fastcall"` is not supported for the current target
 --> <source>:6:1
  |
6 | / extern "fastcall" fn foo() { 
7 | | }
  | |_^

Targets should be reviewed for such nonsensical ABIs and their blacklists updated. I feel that to avoid this issue in the future we should rather prefer a whitelist of ABIs, rather than a blacklist, and by default put no ABIs, so that the compilation fails until the ABI list is properly populated for the target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-FFIArea: Foreign function interface (FFI)A-target-specsArea: Compile-target specificationsC-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions