Fix linking issues with lang items
This commit is contained in:
+3
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
#![no_std]
|
||||
#![feature(asm)]
|
||||
#![feature(linkage)]
|
||||
#![feature(naked_functions)]
|
||||
#![feature(panic_implementation)]
|
||||
|
||||
@@ -60,8 +61,9 @@ pub unsafe extern "C" fn _start_rust(sp: &'static Stack) -> ! {
|
||||
}
|
||||
|
||||
#[panic_implementation]
|
||||
#[linkage = "weak"]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _start_panic(pi: &::core::panic::PanicInfo) -> ! {
|
||||
pub extern "C" fn rust_begin_unwind(pi: &::core::panic::PanicInfo) -> ! {
|
||||
use core::fmt::Write;
|
||||
|
||||
let mut w = platform::FileWriter(2);
|
||||
|
||||
+27
-3
@@ -1,5 +1,6 @@
|
||||
#![no_std]
|
||||
#![feature(lang_items)]
|
||||
#![feature(linkage)]
|
||||
#![feature(panic_implementation)]
|
||||
|
||||
//extern crate compiler_builtins;
|
||||
@@ -28,9 +29,11 @@ pub extern crate time;
|
||||
pub extern crate unistd;
|
||||
pub extern crate wctype;
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[panic_implementation]
|
||||
#[linkage = "weak"]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn relibc_panic(pi: &::core::panic::PanicInfo) -> ! {
|
||||
pub extern "C" fn rust_begin_unwind(pi: &::core::panic::PanicInfo) -> ! {
|
||||
use core::fmt::Write;
|
||||
|
||||
let mut w = platform::FileWriter(2);
|
||||
@@ -39,9 +42,17 @@ pub extern "C" fn relibc_panic(pi: &::core::panic::PanicInfo) -> ! {
|
||||
platform::exit(1);
|
||||
}
|
||||
|
||||
#[lang = "oom"]
|
||||
#[cfg(not(test))]
|
||||
#[lang = "eh_personality"]
|
||||
#[no_mangle]
|
||||
pub extern fn relibc_oom(layout: ::core::alloc::Layout) -> ! {
|
||||
#[linkage = "weak"]
|
||||
pub extern "C" fn rust_eh_personality() {}
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[lang = "oom"]
|
||||
#[linkage = "weak"]
|
||||
#[no_mangle]
|
||||
pub extern fn rust_oom(layout: ::core::alloc::Layout) -> ! {
|
||||
use core::fmt::Write;
|
||||
|
||||
let mut w = platform::FileWriter(2);
|
||||
@@ -49,3 +60,16 @@ pub extern fn relibc_oom(layout: ::core::alloc::Layout) -> ! {
|
||||
|
||||
platform::exit(1);
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[allow(non_snake_case)]
|
||||
#[linkage = "weak"]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _Unwind_Resume() -> ! {
|
||||
use core::fmt::Write;
|
||||
|
||||
let mut w = platform::FileWriter(2);
|
||||
let _ = w.write_str("_Unwind_Resume\n");
|
||||
|
||||
platform::exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user