forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
- Loading branch information
Showing
13 changed files
with
92 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
`#[cmse_nonsecure_entry]` functions require a C ABI | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0776 | ||
#![feature(cmse_nonsecure_entry)] | ||
#[no_mangle] | ||
#[cmse_nonsecure_entry] | ||
pub fn entry_function(input: Vec<u32>) {} | ||
``` | ||
|
||
To fix this error, declare your entry function with a C ABI, using `extern "C"`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// gate-test-cmse_nonsecure_entry | ||
|
||
#[no_mangle] | ||
#[cmse_nonsecure_entry] | ||
//~^ ERROR [E0775] | ||
//~| ERROR [E0658] | ||
pub extern "C" fn entry_function(input: u32) -> u32 { | ||
input + 6 | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
error[E0658]: the `#[cmse_nonsecure_entry]` attribute is an experimental feature | ||
--> $DIR/gate_test.rs:4:1 | ||
| | ||
LL | #[cmse_nonsecure_entry] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #75835 <https://github.com/rust-lang/rust/issues/75835> for more information | ||
= help: add `#![feature(cmse_nonsecure_entry)]` to the crate attributes to enable | ||
|
||
error[E0775]: `#[cmse_nonsecure_entry]` is only valid for targets with the TrustZone-M extension | ||
--> $DIR/gate_test.rs:4:1 | ||
| | ||
LL | #[cmse_nonsecure_entry] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0658, E0775. | ||
For more information about an error, try `rustc --explain E0658`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// build-pass | ||
// compile-flags: --target thumbv8m.main-none-eabi --crate-type lib | ||
// only-thumbv8m.main-none-eabi | ||
#![feature(cmse_nonsecure_entry)] | ||
#![no_std] | ||
|
||
#[no_mangle] | ||
#[cmse_nonsecure_entry] | ||
pub extern "C" fn entry_function(a: u32, b: u32, c: u32, d: u32) -> u32 { | ||
a + b + c + d | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
// gate-test-cmse_nonsecure_entry | ||
// compile-flags: --target thumbv8m.main-none-eabi --crate-type lib | ||
// only-thumbv8m.main-none-eabi | ||
#![feature(cmse_nonsecure_entry)] | ||
#![no_std] | ||
|
||
#[no_mangle] | ||
#[cmse_nonsecure_entry] | ||
pub extern "C" fn entry_function(a: u32, b: u32, c: u32, d: u32, e: u32) -> u32 { | ||
pub extern "C" fn entry_function(a: u32, b: u32, c: u32, d: u32, e: u32) -> u32 { //~ ERROR | ||
a + b + c + d + e | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// gate-test-cmse_nonsecure_entry | ||
// ignore-thumbv8m.main-none-eabi | ||
#![feature(cmse_nonsecure_entry)] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// compile-flags: --target thumbv8m.main-none-eabi --crate-type lib | ||
// only-thumbv8m.main-none-eabi | ||
#![feature(cmse_nonsecure_entry)] | ||
#![no_std] | ||
|
||
#[no_mangle] | ||
#[cmse_nonsecure_entry] | ||
pub fn entry_function(a: u32, b: u32, c: u32, d: u32) -> u32 { //~ ERROR [E0776] | ||
a + b + c + d | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0776]: `#[cmse_nonsecure_entry]` functions require C ABI | ||
--> $DIR/wrong-abi.rs:7:1 | ||
| | ||
LL | #[cmse_nonsecure_entry] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0776`. |