about summary refs log tree commit diff
path: root/src/libstd/sys/common
diff options
context:
space:
mode:
authorVadim Chugunov <vadimcn@gmail.com>2015-10-18 14:28:47 -0700
committerVadim Chugunov <vadimcn@gmail.com>2015-10-18 19:57:32 -0700
commitdef917afeb4ae4668010c2ff2b2757ed7ac4931a (patch)
tree59ea2cfebaf29c154c4e4103031e8f2e8036a4bb /src/libstd/sys/common
parent1da466253c1fe6491f330a4ae5aa56da950928bf (diff)
downloadrust-def917afeb4ae4668010c2ff2b2757ed7ac4931a.tar.gz
rust-def917afeb4ae4668010c2ff2b2757ed7ac4931a.zip
Implement `eh_unwind_resume` in libstd.
Diffstat (limited to 'src/libstd/sys/common')
-rw-r--r--src/libstd/sys/common/libunwind.rs3
-rw-r--r--src/libstd/sys/common/unwind/gcc.rs7
-rw-r--r--src/libstd/sys/common/unwind/seh64_gnu.rs11
3 files changed, 12 insertions, 9 deletions
diff --git a/src/libstd/sys/common/libunwind.rs b/src/libstd/sys/common/libunwind.rs
index da7ebbf4ed3..04f677a90c4 100644
--- a/src/libstd/sys/common/libunwind.rs
+++ b/src/libstd/sys/common/libunwind.rs
@@ -142,6 +142,9 @@ extern "C" {
                                    -> _Unwind_Reason_Code;
 
     pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
+
+    #[unwind]
+    pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
 }
 
 // ... and now we just providing access to SjLj counterspart
diff --git a/src/libstd/sys/common/unwind/gcc.rs b/src/libstd/sys/common/unwind/gcc.rs
index 361cef08c11..5ee14d9f57a 100644
--- a/src/libstd/sys/common/unwind/gcc.rs
+++ b/src/libstd/sys/common/unwind/gcc.rs
@@ -231,3 +231,10 @@ pub mod eabi {
         }
     }
 }
+
+#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu", not(test)))]
+#[lang = "eh_unwind_resume"]
+#[unwind]
+unsafe extern fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! {
+    uw::_Unwind_Resume(panic_ctx as *mut uw::_Unwind_Exception);
+}
diff --git a/src/libstd/sys/common/unwind/seh64_gnu.rs b/src/libstd/sys/common/unwind/seh64_gnu.rs
index 9478678fda9..92f059d68e1 100644
--- a/src/libstd/sys/common/unwind/seh64_gnu.rs
+++ b/src/libstd/sys/common/unwind/seh64_gnu.rs
@@ -190,17 +190,10 @@ unsafe extern fn rust_eh_personality(
     ExceptionContinueSearch
 }
 
-// The `resume` instruction, found at the end of the landing pads, and whose job
-// is to resume stack unwinding, is typically lowered by LLVM into a call to
-// `_Unwind_Resume` routine.  To avoid confusion with the same symbol exported
-// from libgcc, we redirect it to `rust_eh_unwind_resume`.
-// Since resolution of this symbol is done by the linker, `rust_eh_unwind_resume`
-// must be marked `pub` + `#[no_mangle]`.  (Can we make it a lang item?)
-
-#[lang = "eh_unwind_resume"]
 #[cfg(not(test))]
+#[lang = "eh_unwind_resume"]
 #[unwind]
-unsafe extern fn rust_eh_unwind_resume(panic_ctx: LPVOID) {
+unsafe extern fn rust_eh_unwind_resume(panic_ctx: LPVOID) -> ! {
     let params = [panic_ctx as ULONG_PTR];
     RaiseException(RUST_PANIC,
                    EXCEPTION_NONCONTINUABLE,