forked from M-Labs/artiq
runtime: simplify. NFC.
This commit is contained in:
parent
061fb3dcd5
commit
6e341da3a1
|
@ -1,5 +1,4 @@
|
||||||
#![feature(libc, panic_unwind, never_type)]
|
#![feature(libc, panic_unwind)]
|
||||||
#![allow(non_upper_case_globals, non_camel_case_types)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate unwind;
|
extern crate unwind;
|
||||||
|
@ -8,13 +7,6 @@ extern crate libc;
|
||||||
use unwind as uw;
|
use unwind as uw;
|
||||||
use libc::c_void;
|
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>
|
pub fn backtrace<F>(mut f: F) -> Result<(), uw::_Unwind_Reason_Code>
|
||||||
where F: FnMut(usize) -> ()
|
where F: FnMut(usize) -> ()
|
||||||
{
|
{
|
||||||
|
@ -30,7 +22,7 @@ pub fn backtrace<F>(mut f: F) -> Result<(), uw::_Unwind_Reason_Code>
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
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(()),
|
uw::_URC_NO_REASON => Ok(()),
|
||||||
err => Err(err)
|
err => Err(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ CFLAGS += \
|
||||||
-I$(LIBUNWIND_DIRECTORY)/../unwinder/include \
|
-I$(LIBUNWIND_DIRECTORY)/../unwinder/include \
|
||||||
|
|
||||||
LDFLAGS += -L../libbase \
|
LDFLAGS += -L../libbase \
|
||||||
-L../libprintf \
|
|
||||||
-L../libunwind
|
-L../libunwind
|
||||||
|
|
||||||
RUSTFLAGS += -Cpanic=abort
|
RUSTFLAGS += -Cpanic=abort
|
||||||
|
@ -19,7 +18,7 @@ $(RUSTOUT)/libruntime.a:
|
||||||
|
|
||||||
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
|
runtime.elf: $(RUSTOUT)/libruntime.a ksupport_data.o
|
||||||
$(LD) $(LDFLAGS) -T $(RUNTIME_DIRECTORY)/runtime.ld -o $@ $^ \
|
$(LD) $(LDFLAGS) -T $(RUNTIME_DIRECTORY)/runtime.ld -o $@ $^ \
|
||||||
-lunwind-bare -lprintf-nofloat --eh-frame-hdr
|
-lunwind-bare
|
||||||
@chmod -x $@
|
@chmod -x $@
|
||||||
|
|
||||||
ksupport_data.o: ../ksupport/ksupport.elf
|
ksupport_data.o: ../ksupport/ksupport.elf
|
||||||
|
|
Loading…
Reference in New Issue