From 25c9b8827acd9aab25274106b9511c235a65f47f Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 5 Feb 2017 09:04:22 +0000 Subject: [PATCH] firmware: mark __artiq_{re,}raise as #[unwind]. This is required for correctness. --- artiq/firmware/ksupport/eh.rs | 2 ++ artiq/firmware/ksupport/lib.rs | 2 +- artiq/test/libartiq_support/lib.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/artiq/firmware/ksupport/eh.rs b/artiq/firmware/ksupport/eh.rs index 7d908340d..171835cf4 100644 --- a/artiq/firmware/ksupport/eh.rs +++ b/artiq/firmware/ksupport/eh.rs @@ -407,6 +407,7 @@ static mut INFLIGHT: ExceptionInfo = ExceptionInfo { }; #[export_name="__artiq_raise"] +#[unwind] pub unsafe extern fn raise(exception: *const Exception) -> ! { // Zing! The Exception<'a> as Exception<'static> cast is not really sound in case // the exception is ever captured. Fortunately, they currently aren't, and we save @@ -424,6 +425,7 @@ pub unsafe extern fn raise(exception: *const Exception) -> ! { } #[export_name="__artiq_reraise"] +#[unwind] pub unsafe extern fn reraise() -> ! { if INFLIGHT.handled { raise(&INFLIGHT.exception.unwrap()) diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index c762da4e5..944aa1183 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -1,4 +1,4 @@ -#![feature(lang_items, asm, libc, panic_unwind)] +#![feature(lang_items, asm, libc, panic_unwind, unwind_attributes)] #![no_std] extern crate alloc_none; diff --git a/artiq/test/libartiq_support/lib.rs b/artiq/test/libartiq_support/lib.rs index 8fc08a0ac..d9c609fe0 100644 --- a/artiq/test/libartiq_support/lib.rs +++ b/artiq/test/libartiq_support/lib.rs @@ -1,4 +1,4 @@ -#![feature(libc, panic_unwind)] +#![feature(libc, panic_unwind, unwind_attributes)] #![crate_name = "artiq_support"] #![crate_type = "cdylib"]