Skip to content

Commit 7b4d4ab

Browse files
Tropix126max-niederman
authored andcommitted
add default code signature, ensure stdout flush
1 parent 8cd06a4 commit 7b4d4ab

File tree

1 file changed

+15
-0
lines changed
  • library/std/src/sys/pal/vexos

1 file changed

+15
-0
lines changed

library/std/src/sys/pal/vexos/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ pub unsafe extern "C" fn _start() -> ! {
5252
abort_internal()
5353
}
5454

55+
#[link_section = ".code_signature"]
56+
#[linkage = "weak"]
57+
#[used]
58+
static CODE_SIGNATURE: vex_sdk::vcodesig = vex_sdk::vcodesig {
59+
magic: u32::from_le_bytes(*b"XVX5"),
60+
r#type: 2,
61+
owner: 0,
62+
options: 0,
63+
};
64+
5565
// This function is needed by the panic runtime. The symbol is named in
5666
// pre-link args for the target specification, so keep that in sync.
5767
#[cfg(not(test))]
@@ -61,8 +71,12 @@ pub extern "C" fn __rust_abort() -> ! {
6171
abort_internal()
6272
}
6373

74+
// SAFETY: must be called only once during runtime initialization.
75+
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
6476
pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
6577

78+
// SAFETY: must be called only once during runtime cleanup.
79+
// NOTE: this is not guaranteed to run, for example when the program aborts.
6680
pub unsafe fn cleanup() {}
6781

6882
pub fn unsupported<T>() -> crate::io::Result<T> {
@@ -83,6 +97,7 @@ pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind {
8397

8498
pub fn abort_internal() -> ! {
8599
unsafe {
100+
vex_sdk::vexTasksRun();
86101
vex_sdk::vexSystemExitRequest();
87102
}
88103

0 commit comments

Comments
 (0)