From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../cmse-nonsecure/cmse-nonsecure-entry/gate_test.rs | 11 +++++++++++ .../cmse-nonsecure-entry/gate_test.stderr | 19 +++++++++++++++++++ .../cmse-nonsecure-entry/issue-83475.rs | 9 +++++++++ .../cmse-nonsecure-entry/issue-83475.stderr | 11 +++++++++++ .../cmse-nonsecure-entry/params-on-registers.rs | 16 ++++++++++++++++ .../cmse-nonsecure-entry/params-on-stack.rs | 16 ++++++++++++++++ .../cmse-nonsecure-entry/params-on-stack.stderr | 4 ++++ .../cmse-nonsecure-entry/trustzone-only.rs | 10 ++++++++++ .../cmse-nonsecure-entry/trustzone-only.stderr | 9 +++++++++ .../cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs | 13 +++++++++++++ .../cmse-nonsecure-entry/wrong-abi.stderr | 9 +++++++++ 11 files changed, 127 insertions(+) create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.rs create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs create mode 100644 tests/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr (limited to 'tests/ui/cmse-nonsecure/cmse-nonsecure-entry') diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.rs new file mode 100644 index 000000000..02d5f20fe --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.rs @@ -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() {} diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr new file mode 100644 index 000000000..75a29b317 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr @@ -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 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`. diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs new file mode 100644 index 000000000..a839406cd --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs @@ -0,0 +1,9 @@ +// Regression test for the ICE described in #83475. + +#![crate_type="lib"] + +#![feature(cmse_nonsecure_entry)] +#[cmse_nonsecure_entry] +//~^ ERROR: attribute should be applied to a function definition +struct XEmpty2; +//~^ NOTE: not a function definition diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr new file mode 100644 index 000000000..426d82d8d --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr @@ -0,0 +1,11 @@ +error: attribute should be applied to a function definition + --> $DIR/issue-83475.rs:6:1 + | +LL | #[cmse_nonsecure_entry] + | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | struct XEmpty2; + | --------------- not a function definition + +error: aborting due to previous error + diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs new file mode 100644 index 000000000..5591a8a58 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs @@ -0,0 +1,16 @@ +// build-pass +// compile-flags: --target thumbv8m.main-none-eabi --crate-type lib +// needs-llvm-components: arm +#![feature(cmse_nonsecure_entry, no_core, lang_items)] +#![no_core] +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } +impl Copy for u32 {} + +#[no_mangle] +#[cmse_nonsecure_entry] +pub extern "C" fn entry_function(_: u32, _: u32, _: u32, d: u32) -> u32 { + d +} diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs new file mode 100644 index 000000000..39b41dac4 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs @@ -0,0 +1,16 @@ +// build-fail +// compile-flags: --target thumbv8m.main-none-eabi --crate-type lib +// needs-llvm-components: arm +#![feature(cmse_nonsecure_entry, no_core, lang_items)] +#![no_core] +#[lang="sized"] +trait Sized { } +#[lang="copy"] +trait Copy { } +impl Copy for u32 {} + +#[no_mangle] +#[cmse_nonsecure_entry] +pub extern "C" fn entry_function(_: u32, _: u32, _: u32, _: u32, e: u32) -> u32 { + e +} diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr new file mode 100644 index 000000000..1054c2665 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr @@ -0,0 +1,4 @@ +error: :0:0: in function entry_function i32 (i32, i32, i32, i32, i32): secure entry function requires arguments on stack + +error: aborting due to previous error + diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs new file mode 100644 index 000000000..3783e2794 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs @@ -0,0 +1,10 @@ +// ignore-thumbv8m.main-none-eabi +#![feature(cmse_nonsecure_entry)] + +#[no_mangle] +#[cmse_nonsecure_entry] //~ ERROR [E0775] +pub extern "C" fn entry_function(input: u32) -> u32 { + input + 6 +} + +fn main() {} diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr new file mode 100644 index 000000000..7e8862f9a --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr @@ -0,0 +1,9 @@ +error[E0775]: `#[cmse_nonsecure_entry]` is only valid for targets with the TrustZone-M extension + --> $DIR/trustzone-only.rs:5:1 + | +LL | #[cmse_nonsecure_entry] + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0775`. diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs new file mode 100644 index 000000000..6320d2963 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs @@ -0,0 +1,13 @@ +// compile-flags: --target thumbv8m.main-none-eabi --crate-type lib +// needs-llvm-components: arm +#![feature(cmse_nonsecure_entry, no_core, lang_items)] +#![no_core] +#[lang="sized"] +trait Sized { } + +#[no_mangle] +#[cmse_nonsecure_entry] +//~^ ERROR `#[cmse_nonsecure_entry]` requires C ABI [E0776] +pub fn entry_function(_: u32, _: u32, _: u32, d: u32) -> u32 { + d +} diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr new file mode 100644 index 000000000..36d76c967 --- /dev/null +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr @@ -0,0 +1,9 @@ +error[E0776]: `#[cmse_nonsecure_entry]` requires C ABI + --> $DIR/wrong-abi.rs:9:1 + | +LL | #[cmse_nonsecure_entry] + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0776`. -- cgit v1.2.3