Miscellaneous
操作系统相关
[profile.dev] panic = "abort" [profile.release] panic = "abort"
// src/main.rs #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points 不使用常规入口点 use core::panic::PanicInfo; // This function is called on panic. #[panic_handler] fn panic(_info: &PanicInfo) -> ! { loop {} } // 返回值为!表示不允许返回 #[no_mangle] // don't mangle the name of this function 确保函数名不被程序(为了保证唯一性而)更改 pub extern "C" fn _start() -> ! { // this function is the entry point, since the linker looks for a function named `_start` by default loop {} } // extern "C" 标识这是一个C函数
Last updated