diff --git a/mk/platform.mk b/mk/platform.mk index d1ec7c6500d25..dc2fe5c476db3 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -521,7 +521,7 @@ CFG_PATH_MUNGE_i686-w64-mingw32 := CFG_LDPATH_i686-w64-mingw32 :=$(CFG_LDPATH_i686-w64-mingw32):$(PATH) CFG_RUN_i686-w64-mingw32=PATH="$(CFG_LDPATH_i686-w64-mingw32):$(1)" $(2) CFG_RUN_TARG_i686-w64-mingw32=$(call CFG_RUN_i686-w64-mingw32,$(HLIB$(1)_H_$(CFG_BUILD)),$(2)) -RUSTC_CROSS_FLAGS_i686-w64-mingw32 := +RUSTC_CROSS_FLAGS_i686-w64-mingw32 :=--cfg sjlj # x86_64-w64-mingw32 configuration CROSS_PREFIX_x86_64-w64-mingw32=x86_64-w64-mingw32- diff --git a/src/librustrt/libunwind.rs b/src/librustrt/libunwind.rs index f018b3fc16b3b..6f086026e4d11 100644 --- a/src/librustrt/libunwind.rs +++ b/src/librustrt/libunwind.rs @@ -98,10 +98,11 @@ extern {} extern "C" { // iOS on armv7 uses SjLj exceptions and requires to link // against corresponding routine (..._SjLj_...) - #[cfg(not(target_os = "ios", target_arch = "arm"))] + #[cfg(not(target_os = "ios", target_arch = "arm"), not(sjlj))] pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code; + #[cfg(sjlj)] #[cfg(target_os = "ios", target_arch = "arm")] fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code; @@ -112,6 +113,7 @@ extern "C" { // ... and now we just providing access to SjLj counterspart // through a standard name to hide those details from others // (see also comment above regarding _Unwind_RaiseException) +#[cfg(sjlj)] #[cfg(target_os = "ios", target_arch = "arm")] #[inline(always)] pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception) diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs index f26cccdd3ed90..086f548da56cd 100644 --- a/src/librustrt/unwind.rs +++ b/src/librustrt/unwind.rs @@ -224,7 +224,7 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class { // This is achieved by overriding the return value in search phase to always // say "catch!". -#[cfg(not(target_arch = "arm"), not(test))] +#[cfg(not(target_arch = "arm"), not(test), not(sjlj))] #[doc(hidden)] #[allow(visible_private_types)] pub mod eabi { @@ -279,6 +279,7 @@ pub mod eabi { // iOS on armv7 is using SjLj exceptions and therefore requires to use // a specialized personality routine: __gcc_personality_sj0 +#[cfg(sjlj)] #[cfg(target_os = "ios", target_arch = "arm", not(test))] #[doc(hidden)] #[allow(visible_private_types)] @@ -521,3 +522,11 @@ pub unsafe fn register(f: Callback) -> bool { } } } + +// dummy functions for #12859 +#[cfg(sjlj)] +#[no_mangle] +#[allow(non_snake_case_functions)] +pub extern "C" fn _Unwind_Resume(_ex_obj: *mut ()) { + // _ex_obj is actually *mut uw::_Unwind_Exception, but it is private +}