Skip to content

Commit def917a

Browse files
committed
Implement eh_unwind_resume in libstd.
1 parent 1da4662 commit def917a

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/libstd/sys/common/libunwind.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ extern "C" {
142142
-> _Unwind_Reason_Code;
143143

144144
pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
145+
146+
#[unwind]
147+
pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
145148
}
146149

147150
// ... and now we just providing access to SjLj counterspart

src/libstd/sys/common/unwind/gcc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,10 @@ pub mod eabi {
231231
}
232232
}
233233
}
234+
235+
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu", not(test)))]
236+
#[lang = "eh_unwind_resume"]
237+
#[unwind]
238+
unsafe extern fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! {
239+
uw::_Unwind_Resume(panic_ctx as *mut uw::_Unwind_Exception);
240+
}

src/libstd/sys/common/unwind/seh64_gnu.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,10 @@ unsafe extern fn rust_eh_personality(
190190
ExceptionContinueSearch
191191
}
192192

193-
// The `resume` instruction, found at the end of the landing pads, and whose job
194-
// is to resume stack unwinding, is typically lowered by LLVM into a call to
195-
// `_Unwind_Resume` routine. To avoid confusion with the same symbol exported
196-
// from libgcc, we redirect it to `rust_eh_unwind_resume`.
197-
// Since resolution of this symbol is done by the linker, `rust_eh_unwind_resume`
198-
// must be marked `pub` + `#[no_mangle]`. (Can we make it a lang item?)
199-
200-
#[lang = "eh_unwind_resume"]
201193
#[cfg(not(test))]
194+
#[lang = "eh_unwind_resume"]
202195
#[unwind]
203-
unsafe extern fn rust_eh_unwind_resume(panic_ctx: LPVOID) {
196+
unsafe extern fn rust_eh_unwind_resume(panic_ctx: LPVOID) -> ! {
204197
let params = [panic_ctx as ULONG_PTR];
205198
RaiseException(RUST_PANIC,
206199
EXCEPTION_NONCONTINUABLE,

0 commit comments

Comments
 (0)