Prevent override of panic from relibc

This commit is contained in:
Jeremy Soller
2019-03-27 20:56:23 -06:00
parent 229ca66726
commit a88ec09131
3 changed files with 9 additions and 25 deletions
+3 -9
View File
@@ -2,7 +2,7 @@
#![no_std]
#![feature(asm)]
#![feature(lang_items)]
#![feature(core_intrinsics)]
#![feature(linkage)]
#![feature(naked_functions)]
@@ -29,12 +29,6 @@ pub unsafe extern "C" fn _start() {
}
#[panic_handler]
#[linkage = "weak"]
#[no_mangle]
pub extern "C" fn rust_begin_unwind(_pi: &::core::panic::PanicInfo) -> ! {
extern "C" {
fn exit(status: i32) -> !;
}
unsafe { exit(1) }
unsafe fn panic(_pi: &::core::panic::PanicInfo) -> ! {
::core::intrinsics::abort();
}
+3 -8
View File
@@ -1,6 +1,7 @@
//! crti
#![no_std]
#![feature(core_intrinsics)]
#![feature(global_asm)]
#![feature(linkage)]
@@ -46,12 +47,6 @@ global_asm!(r#"
"#);
#[panic_handler]
#[linkage = "weak"]
#[no_mangle]
pub extern "C" fn rust_begin_unwind(_pi: &::core::panic::PanicInfo) -> ! {
extern "C" {
fn exit(status: i32) -> !;
}
unsafe { exit(1) }
unsafe fn panic(_pi: &::core::panic::PanicInfo) -> ! {
::core::intrinsics::abort();
}
+3 -8
View File
@@ -1,6 +1,7 @@
//! crti
#![no_std]
#![feature(core_intrinsics)]
#![feature(global_asm)]
#![feature(linkage)]
@@ -36,12 +37,6 @@ global_asm!(r#"
"#);
#[panic_handler]
#[linkage = "weak"]
#[no_mangle]
pub extern "C" fn rust_begin_unwind(_pi: &::core::panic::PanicInfo) -> ! {
extern "C" {
fn exit(status: i32) -> !;
}
unsafe { exit(1) }
unsafe fn panic(_pi: &::core::panic::PanicInfo) -> ! {
::core::intrinsics::abort();
}