runtime: simplify. NFC.

pull/882/merge
whitequark 2017-12-26 02:31:28 +00:00
parent 061fb3dcd5
commit 6e341da3a1
2 changed files with 3 additions and 12 deletions

View File

@ -1,5 +1,4 @@
#![feature(libc, panic_unwind, never_type)]
#![allow(non_upper_case_globals, non_camel_case_types)]
#![feature(libc, panic_unwind)]
#![no_std]
extern crate unwind;
@ -8,13 +7,6 @@ extern crate libc;
use unwind as uw;
use libc::c_void;
type _Unwind_Trace_Fn = extern "C" fn(*mut uw::_Unwind_Context, *mut c_void)
-> uw::_Unwind_Reason_Code;
extern {
fn _Unwind_Backtrace(trace_fn: _Unwind_Trace_Fn, arg: *mut c_void)
-> uw::_Unwind_Reason_Code;
}
pub fn backtrace<F>(mut f: F) -> Result<(), uw::_Unwind_Reason_Code>
where F: FnMut(usize) -> ()
{
@ -30,7 +22,7 @@ pub fn backtrace<F>(mut f: F) -> Result<(), uw::_Unwind_Reason_Code>
}
unsafe {
match _Unwind_Backtrace(trace::<F>, &mut f as *mut _ as *mut c_void) {
match uw::_Unwind_Backtrace(trace::<F>, &mut f as *mut _ as *mut c_void) {
uw::_URC_NO_REASON => Ok(()),
err => Err(err)
}

View File

@ -6,7 +6,6 @@ CFLAGS += \
-I$(LIBUNWIND_DIRECTORY)/../unwinder/include \
LDFLAGS += -L../libbase \
-L../libprintf \
-L../libunwind
RUSTFLAGS += -Cpanic=abort
@ -19,7 +18,7 @@ $(RUSTOUT)/libruntime.a:
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
$(LD) $(LDFLAGS) -T $(RUNTIME_DIRECTORY)/runtime.ld -o $@ $^ \
-lunwind-bare -lprintf-nofloat --eh-frame-hdr
-lunwind-bare
@chmod -x $@
ksupport_data.o: ../ksupport/ksupport.elf