mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 02:46:47 +00:00
17 lines
352 B
Rust
17 lines
352 B
Rust
#![no_std]
|
|
#![no_main]
|
|
|
|
use core::panic::PanicInfo;
|
|
|
|
#[no_mangle]
|
|
pub extern "C" fn rust_helloworld_a_plus_b(a: i32, b: i32) -> i32 {
|
|
return a+b;
|
|
}
|
|
|
|
/// 这个函数将在panic时被调用
|
|
#[panic_handler]
|
|
fn panic(_info: &PanicInfo) -> ! {
|
|
loop {}
|
|
}
|
|
|
|
// rustc --crate-type staticlib --target x86_64-unknown-none -o helloworld.o helloworld.rs
|