Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMSE features should check ABI conformance in rustc, not LLVM #81347

Open
jonas-schievink opened this issue Jan 24, 2021 · 0 comments
Open

CMSE features should check ABI conformance in rustc, not LLVM #81347

jonas-schievink opened this issue Jan 24, 2021 · 0 comments
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. F-abi_c_cmse_nonsecure_call `#![feature(abi_c_cmse_nonsecure_call)]` F-cmse_nonsecure_entry `#![feature(cmse_nonsecure_entry)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jonas-schievink
Copy link
Contributor

jonas-schievink commented Jan 24, 2021

Using #[cmse_nonsecure_entry] on a function limits its capabilities. Namely, only up to 4 32-bit arguments can be accepted, and none of them may be passed on the stack. The same is true for the "C-cmse-nonsecure-call" ABI.

Currently, this is checked in LLVM, so the user experience is sub-par, and the check happens very late (during codegen instead of type checking). It should be checked in rustc instead.

@jonas-schievink jonas-schievink added A-codegen Area: Code generation T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. F-cmse_nonsecure_entry `#![feature(cmse_nonsecure_entry)]` labels Jan 24, 2021
@jonas-schievink jonas-schievink changed the title #[cmse_nonsecure_entry] should check ABI conformance in rustc, not LLVM CMSE features should check ABI conformance in rustc, not LLVM Jan 30, 2021
@jonas-schievink jonas-schievink added the F-abi_c_cmse_nonsecure_call `#![feature(abi_c_cmse_nonsecure_call)]` label Jan 30, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 19, 2024
…rror-messages, r=oli-obk

`C-cmse-nonsecure-call`: improved error messages

tracking issue: rust-lang#81391
issue for the error messages (partially implemented by this PR): rust-lang#81347
related, in that it also deals with CMSE: rust-lang#127766

When using the `C-cmse-nonsecure-call` ABI, both the arguments and return value must be passed via registers. Previously, when violating this constraint, an ugly LLVM error would be shown. Now, the rust compiler itself will print a pretty message and link to more information.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 19, 2024
Rollup merge of rust-lang#127814 - folkertdev:c-cmse-nonsecure-call-error-messages, r=oli-obk

`C-cmse-nonsecure-call`: improved error messages

tracking issue: rust-lang#81391
issue for the error messages (partially implemented by this PR): rust-lang#81347
related, in that it also deals with CMSE: rust-lang#127766

When using the `C-cmse-nonsecure-call` ABI, both the arguments and return value must be passed via registers. Previously, when violating this constraint, an ugly LLVM error would be shown. Now, the rust compiler itself will print a pretty message and link to more information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. F-abi_c_cmse_nonsecure_call `#![feature(abi_c_cmse_nonsecure_call)]` F-cmse_nonsecure_entry `#![feature(cmse_nonsecure_entry)]` T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant