Skip to content

Commit eb49cb1

Browse files
committed
move _Unwind_RaiseException out of the frame_in_std section
1 parent a23dae0 commit eb49cb1

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/shims/windows/foreign_items.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,22 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
820820
this.write_int(length.strict_sub(1), dest)?;
821821
}
822822

823+
"_Unwind_RaiseException" => {
824+
// This is not formally part of POSIX, but it is very wide-spread on POSIX systems.
825+
// It was originally specified as part of the Itanium C++ ABI:
826+
// https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#base-throw.
827+
// MinGW implements _Unwind_RaiseException on top of SEH exceptions.
828+
if this.tcx.sess.target.env != "gnu" {
829+
throw_unsup_format!(
830+
"`_Unwind_RaiseException` is not supported on non-MinGW Windows",
831+
);
832+
}
833+
// This function looks and behaves excatly like miri_start_unwind.
834+
let [payload] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
835+
this.handle_miri_start_unwind(payload)?;
836+
return interp_ok(EmulateItemResult::NeedsUnwind);
837+
}
838+
823839
// Incomplete shims that we "stub out" just to get pre-main initialization code to work.
824840
// These shims are enabled only when the caller is in the standard library.
825841
"GetProcessHeap" if this.frame_in_std() => {
@@ -880,22 +896,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
880896
this.write_null(dest)?;
881897
}
882898

883-
"_Unwind_RaiseException" => {
884-
// This is not formally part of POSIX, but it is very wide-spread on POSIX systems.
885-
// It was originally specified as part of the Itanium C++ ABI:
886-
// https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html#base-throw.
887-
// MinGW implements _Unwind_RaiseException on top of SEH exceptions.
888-
if this.tcx.sess.target.env != "gnu" {
889-
throw_unsup_format!(
890-
"`_Unwind_RaiseException` is not supported on non-MinGW Windows",
891-
);
892-
}
893-
// This function looks and behaves excatly like miri_start_unwind.
894-
let [payload] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
895-
this.handle_miri_start_unwind(payload)?;
896-
return interp_ok(EmulateItemResult::NeedsUnwind);
897-
}
898-
899899
_ => return interp_ok(EmulateItemResult::NotSupported),
900900
}
901901

0 commit comments

Comments
 (0)