File: return-via-stack.rs

package info (click to toggle)
rustc 1.86.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 913,560 kB
  • sloc: xml: 158,127; python: 35,921; javascript: 19,689; sh: 19,600; cpp: 18,906; ansic: 13,124; asm: 4,376; makefile: 708; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (83 lines) | stat: -rw-r--r-- 1,778 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
//@ needs-llvm-components: arm
//@ add-core-stubs

#![feature(cmse_nonsecure_entry, no_core, lang_items)]
#![no_core]

extern crate minicore;
use minicore::*;

#[repr(C)]
pub struct ReprCU64(u64);

#[repr(C)]
pub struct ReprCBytes(u8, u8, u8, u8, u8);

#[repr(C)]
pub struct U64Compound(u32, u32);

#[repr(C, align(16))]
pub struct ReprCAlign16(u16);

#[no_mangle]
pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 {
    //~^ ERROR [E0798]
    ReprCU64(0)
}
#[no_mangle]
pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes {
    //~^ ERROR [E0798]
    ReprCBytes(0, 1, 2, 3, 4)
}
#[no_mangle]
pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound {
    //~^ ERROR [E0798]
    U64Compound(2, 3)
}
#[no_mangle]
pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 {
    //~^ ERROR [E0798]
    ReprCAlign16(4)
}

#[no_mangle]
#[allow(improper_ctypes_definitions)]
pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] {
    //~^ ERROR [E0798]
    [0xAA; 5]
}
#[no_mangle]
#[allow(improper_ctypes_definitions)]
pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 {
    //~^ ERROR [E0798]
    123
}
#[no_mangle]
#[allow(improper_ctypes_definitions)]
pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 {
    //~^ ERROR [E0798]
    456
}

#[repr(Rust)]
pub union ReprRustUnionU64 {
    _unused: u64,
}

#[repr(C)]
pub union ReprCUnionU64 {
    _unused: u64,
}

#[no_mangle]
#[allow(improper_ctypes_definitions)]
pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 {
    //~^ ERROR [E0798]
    ReprRustUnionU64 { _unused: 1 }
}
#[no_mangle]
pub extern "C-cmse-nonsecure-entry" fn union_c() -> ReprCUnionU64 {
    //~^ ERROR [E0798]
    ReprCUnionU64 { _unused: 2 }
}