helloworld.rs 352 B

1234567891011121314151617
  1. #![no_std]
  2. #![no_main]
  3. use core::panic::PanicInfo;
  4. #[no_mangle]
  5. pub extern "C" fn rust_helloworld_a_plus_b(a: i32, b: i32) -> i32 {
  6. return a+b;
  7. }
  8. /// 这个函数将在panic时被调用
  9. #[panic_handler]
  10. fn panic(_info: &PanicInfo) -> ! {
  11. loop {}
  12. }
  13. // rustc --crate-type staticlib --target x86_64-unknown-none -o helloworld.o helloworld.rs