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

add extern "C-cmse-nonsecure-entry" fn #127766

Merged
merged 6 commits into from
Sep 22, 2024

Conversation

folkertdev
Copy link
Contributor

tracking issue #75835

in #75835 (comment) it was decided that using an abi, rather than an attribute, was the right way to go for this feature.

This PR adds that ABI and removes the #[cmse_nonsecure_entry] attribute. All relevant tests have been updated, some are now obsolete and have been removed.

Error 0775 is no longer generated. It contains the list of targets that support the CMSE feature, and maybe we want to still use this? right now a generic "this abi is not supported on this platform" error is returned when this abi is used on an unsupported platform. On the other hand, users of this abi are likely to be experienced rust users, so maybe the generic error is good enough.

@rustbot
Copy link
Collaborator

rustbot commented Jul 15, 2024

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 15, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jul 15, 2024

These commits modify compiler targets.
(See the Target Tier Policy.)

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

This PR changes Stable MIR

cc @oli-obk, @celinval, @ouz-a

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 15, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@lcnr
Copy link
Contributor

lcnr commented Jul 16, 2024

r? compiler

@rustbot rustbot assigned fmease and unassigned lcnr Jul 16, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request 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 pull request 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.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jul 20, 2024
…ages, r=oli-obk

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

tracking issue: #81391
issue for the error messages (partially implemented by this PR): #81347
related, in that it also deals with CMSE: rust-lang/rust#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.
@rustbot
Copy link
Collaborator

rustbot commented Jul 22, 2024

HIR ty lowering was modified

cc @fmease

@folkertdev
Copy link
Contributor Author

We've just added nicer error message in the same style as #127814. We believe that this resolves all steps from the tracking issue.

@apiraino
Copy link
Contributor

r? compiler

@rustbot rustbot assigned fee1-dead and unassigned fmease Jul 30, 2024
@fee1-dead
Copy link
Member

r? compiler

@rustbot rustbot assigned jackh726 and unassigned wesleywiser Aug 15, 2024
@bors
Copy link
Contributor

bors commented Sep 20, 2024

☔ The latest upstream changes (presumably #124895) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really sorry for the review delay here.

Overview seems quite straightforward. Given the comment from the lang team in the tracking issue calling for this change, I don't think they need to be involved here.

A couple small comments, but happy to land after a rebase.

@@ -3,11 +3,10 @@ extension.

Erroneous code example:

```compile_fail,E0775
```ignore (no longer emitted)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this test also get the "Note: this error code is no longer emitted by the compiler." at the top?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I added that now. We had some thoughts about re-using this error code, but if we end up doing that we can just remove that note.

/// #[cmse_nonsecure_entry]: with a TrustZone-M extension, declare a
/// function as an entry function from Non-Secure code.
const CMSE_NONSECURE_ENTRY = 1 << 13;
// (Bit 13 was used for `#[cmse_nonsecure_entry]`, but is now unused.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this comment is needed. I guess bit 7 maybe also was used previously but no more? There's no comment there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are just following bit 14 here

        // (Bit 13 was used for `#[cmse_nonsecure_entry]`, but is now unused.)
        // (Bit 14 was used for `#[coverage(off)]`, but is now unused.)

I'm not sure what happened to bit 7, but it seems useful to document what bits were used for (e.g. if we ever run out of bits in this 32-bit integer, and might want to re-use one of the unused ones).

@jackh726 jackh726 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 21, 2024
@folkertdev
Copy link
Contributor Author

Should be all good now

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 21, 2024
@jackh726
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 21, 2024

📌 Commit ac9a49f has been approved by jackh726

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 21, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 21, 2024
… r=jackh726

add `extern "C-cmse-nonsecure-entry" fn`

tracking issue rust-lang#75835

in rust-lang#75835 (comment) it was decided that using an abi, rather than an attribute, was the right way to go for this feature.

This PR adds that ABI and removes the `#[cmse_nonsecure_entry]` attribute. All relevant tests have been updated, some are now obsolete and have been removed.

Error 0775 is no longer generated. It contains the list of targets that support the CMSE feature, and maybe we want to still use this? right now a generic "this abi is not supported on this platform" error is returned when this abi is used on an unsupported platform. On the other hand, users of this abi are likely to be experienced rust users, so maybe the generic error is good enough.
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 21, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#127766 (add `extern "C-cmse-nonsecure-entry" fn` )
 - rust-lang#129629 (Implement Return Type Notation (RTN)'s path form in where clauses)
 - rust-lang#130246 (rustc_expand: remember module `#[path]`s during expansion)
 - rust-lang#130408 (Avoid re-validating UTF-8 in `FromUtf8Error::into_utf8_lossy`)
 - rust-lang#130651 (Add --enable-profiler to armhf dist)
 - rust-lang#130653 (ABI compatibility: mention Result guarantee)
 - rust-lang#130665 (Prevent Deduplication of `LongRunningWarn`)
 - rust-lang#130666 (Assert that `explicit_super_predicates_of` and `explicit_item_super_predicates` truly only contains bounds for the type itself)
 - rust-lang#130667 (compiler: Accept "improper" ctypes in extern "rust-cold" fn)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 21, 2024
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#127766 (add `extern "C-cmse-nonsecure-entry" fn` )
 - rust-lang#129629 (Implement Return Type Notation (RTN)'s path form in where clauses)
 - rust-lang#130408 (Avoid re-validating UTF-8 in `FromUtf8Error::into_utf8_lossy`)
 - rust-lang#130651 (Add --enable-profiler to armhf dist)
 - rust-lang#130653 (ABI compatibility: mention Result guarantee)
 - rust-lang#130666 (Assert that `explicit_super_predicates_of` and `explicit_item_super_predicates` truly only contains bounds for the type itself)
 - rust-lang#130667 (compiler: Accept "improper" ctypes in extern "rust-cold" fn)
 - rust-lang#130673 (Parser: recover from `:::` to `::`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 21, 2024
…mpiler-errors

Rollup of 8 pull requests

Successful merges:

 - rust-lang#127766 (add `extern "C-cmse-nonsecure-entry" fn` )
 - rust-lang#129629 (Implement Return Type Notation (RTN)'s path form in where clauses)
 - rust-lang#130408 (Avoid re-validating UTF-8 in `FromUtf8Error::into_utf8_lossy`)
 - rust-lang#130651 (Add --enable-profiler to armhf dist)
 - rust-lang#130653 (ABI compatibility: mention Result guarantee)
 - rust-lang#130666 (Assert that `explicit_super_predicates_of` and `explicit_item_super_predicates` truly only contains bounds for the type itself)
 - rust-lang#130667 (compiler: Accept "improper" ctypes in extern "rust-cold" fn)
 - rust-lang#130673 (Parser: recover from `:::` to `::`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2a9525b into rust-lang:master Sep 22, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 22, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 22, 2024
Rollup merge of rust-lang#127766 - folkertdev:c-cmse-nonsecure-entry, r=jackh726

add `extern "C-cmse-nonsecure-entry" fn`

tracking issue rust-lang#75835

in rust-lang#75835 (comment) it was decided that using an abi, rather than an attribute, was the right way to go for this feature.

This PR adds that ABI and removes the `#[cmse_nonsecure_entry]` attribute. All relevant tests have been updated, some are now obsolete and have been removed.

Error 0775 is no longer generated. It contains the list of targets that support the CMSE feature, and maybe we want to still use this? right now a generic "this abi is not supported on this platform" error is returned when this abi is used on an unsupported platform. On the other hand, users of this abi are likely to be experienced rust users, so maybe the generic error is good enough.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.