Skip to content

Commit

Permalink
Re-export _Unwind_Resume
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Jan 30, 2020
1 parent a2d6604 commit c6708e6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
20 changes: 13 additions & 7 deletions src/libpanic_unwind/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,25 @@ unsafe fn find_eh_action(
eh::find_eh_action(lsda, &eh_context, foreign_exception)
}

// See docs in the `unwind` module.
#[cfg(all(
target_os = "windows",
any(target_arch = "x86", target_arch = "x86_64"),
target_env = "gnu"
))]
#[cfg_attr(not(bootstrap), lang = "eh_unwind_resume")]
#[used]
pub static RESUME: unsafe extern "C" fn(*mut uw::_Unwind_Exception) -> ! =
uw::_Unwind_Resume as unsafe extern "C" fn(_) -> !;

#[cfg(all(
target_os = "windows",
any(target_arch = "x86", target_arch = "x86_64"),
target_env = "gnu"
))]
#[lang = "eh_unwind_resume"]
#[unwind(allowed)]
// This must always be inlined because _Unwind_Resume expects to be called
// directly from the landing pad.
#[cfg_attr(not(bootstrap), inline(always))]
unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! {
uw::_Unwind_Resume(panic_ctx as *mut uw::_Unwind_Exception);
#[cfg(bootstrap)]
pub unsafe extern "C" fn rust_eh_unwind_resume(p: *mut u8) -> ! {
uw::_Unwind_Resume(p as *mut uw::_Unwind_Exception)
}

// Frame unwind info registration
Expand Down
1 change: 1 addition & 0 deletions src/libpanic_unwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#![feature(raw)]
#![panic_runtime]
#![feature(panic_runtime)]
#![allow(dead_code)]

use alloc::boxed::Box;
use core::any::Any;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ language_item_table! {
StartFnLangItem, "start", start_fn, Target::Fn;

EhPersonalityLangItem, "eh_personality", eh_personality, Target::Fn;
EhUnwindResumeLangItem, "eh_unwind_resume", eh_unwind_resume, Target::Fn;
EhUnwindResumeLangItem, "eh_unwind_resume", eh_unwind_resume, Target::Static;
EhCatchTypeinfoLangItem, "eh_catch_typeinfo", eh_catch_typeinfo, Target::Static;

OwnedBoxLangItem, "owned_box", owned_box, Target::Struct;
Expand Down
1 change: 1 addition & 0 deletions src/libunwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![feature(nll)]
#![feature(staged_api)]
#![feature(unwind_attributes)]
#![feature(lang_items)]
#![feature(static_nobundle)]
#![cfg_attr(not(target_env = "msvc"), feature(libc))]

Expand Down

0 comments on commit c6708e6

Please sign in to comment.