-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #60026 - Aaron1011:feature/miri-unwind, r=RalfJung,oli-obk
Add hooks for Miri panic unwinding This commits adds in some additional hooks to allow Miri to properly handle panic unwinding. None of this should have any impact on CTFE mode This supports rust-lang/miri#693
- Loading branch information
Showing
16 changed files
with
305 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use core::any::Any; | ||
use alloc::boxed::Box; | ||
|
||
pub fn payload() -> *mut u8 { | ||
core::ptr::null_mut() | ||
} | ||
|
||
pub unsafe fn panic(data: Box<dyn Any + Send>) -> ! { | ||
core::intrinsics::miri_start_panic(Box::into_raw(data)) | ||
} | ||
|
||
pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> { | ||
Box::from_raw(ptr) | ||
} | ||
|
||
|
||
// This is required by the compiler to exist (e.g., it's a lang item), | ||
// but is never used by Miri. Therefore, we just use a stub here | ||
#[lang = "eh_personality"] | ||
#[cfg(not(test))] | ||
fn rust_eh_personality() { | ||
unsafe { core::intrinsics::abort() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.