summaryrefslogtreecommitdiffstats
path: root/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/cmse-nonsecure/cmse-nonsecure-entry
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/cmse-nonsecure/cmse-nonsecure-entry')
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.rs11
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr19
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs9
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr11
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs16
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs16
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr4
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs10
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr9
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs13
-rw-r--r--src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr9
11 files changed, 127 insertions, 0 deletions
diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.rs
new file mode 100644
index 000000000..02d5f20fe
--- /dev/null
+++ b/src/test/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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr
new file mode 100644
index 000000000..75a29b317
--- /dev/null
+++ b/src/test/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 <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`.
diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.rs
new file mode 100644
index 000000000..a839406cd
--- /dev/null
+++ b/src/test/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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/issue-83475.stderr
new file mode 100644
index 000000000..426d82d8d
--- /dev/null
+++ b/src/test/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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-registers.rs
new file mode 100644
index 000000000..5591a8a58
--- /dev/null
+++ b/src/test/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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.rs
new file mode 100644
index 000000000..39b41dac4
--- /dev/null
+++ b/src/test/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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr
new file mode 100644
index 000000000..1054c2665
--- /dev/null
+++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/params-on-stack.stderr
@@ -0,0 +1,4 @@
+error: <unknown>: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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs
new file mode 100644
index 000000000..3783e2794
--- /dev/null
+++ b/src/test/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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.stderr
new file mode 100644
index 000000000..7e8862f9a
--- /dev/null
+++ b/src/test/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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.rs
new file mode 100644
index 000000000..6320d2963
--- /dev/null
+++ b/src/test/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/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-entry/wrong-abi.stderr
new file mode 100644
index 000000000..36d76c967
--- /dev/null
+++ b/src/test/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`.