Skip to content

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

New issue

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

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

Already on GitHub? # to your account

Closed
jonas-schievink opened this issue Jan 24, 2021 · 0 comments · Fixed by #130747
Closed

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

jonas-schievink opened this issue Jan 24, 2021 · 0 comments · Fixed by #130747
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.
@bors bors closed this as completed in 731e360 Oct 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 15, 2024
Rollup merge of rust-lang#130747 - folkertdev:c-cmse-nonsecure-entry-error-messages, r=compiler-errors

improve error messages for `C-cmse-nonsecure-entry` functions

fixes rust-lang#81347

tracking issue: rust-lang#75835

brings error messages and testing for `C-cmse-nonsecure-entry` in line with `C-cmse-nonsecure-call`.

r? `@compiler-errors`
# for free to join this conversation on GitHub. Already have an account? # 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

Successfully merging a pull request may close this issue.

1 participant