Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions library/panic_unwind/src/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@

use alloc::boxed::Box;
use core::any::Any;
use core::intrinsics;

unsafe extern "Rust" {
// This is defined in std::rt
#[rustc_std_internal_symbol]
safe fn __rust_abort() -> !;
}

pub(crate) unsafe fn cleanup(_ptr: *mut u8) -> Box<dyn Any + Send> {
intrinsics::abort()
__rust_abort()
}

pub(crate) unsafe fn panic(_data: Box<dyn Any + Send>) -> u32 {
intrinsics::abort()
__rust_abort()
}
20 changes: 0 additions & 20 deletions library/panic_unwind/src/hermit.rs

This file was deleted.

5 changes: 1 addition & 4 deletions library/panic_unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ use core::any::Any;
use core::panic::PanicPayload;

cfg_select! {
target_os = "hermit" => {
#[path = "hermit.rs"]
mod imp;
}
target_os = "l4re" => {
// L4Re is unix family but does not yet support unwinding.
#[path = "dummy.rs"]
Expand Down Expand Up @@ -69,6 +65,7 @@ cfg_select! {
// - os=none ("bare metal" targets)
// - os=uefi
// - os=espidf
// - os=hermit
// - nvptx64-nvidia-cuda
// - arch=avr
#[path = "dummy.rs"]
Expand Down
3 changes: 2 additions & 1 deletion library/std/src/sys/personality/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mod dwarf;

#[cfg(not(any(test, doctest)))]
cfg_select! {
any(target_env = "msvc", target_family = "wasm", target_os = "motor") => {
any(target_env = "msvc", target_family = "wasm") => {
// This is required by the compiler to exist (e.g., it's a lang item),
// but it's never actually called by the compiler because
// __CxxFrameHandler3 (msvc) / __gxx_wasm_personality_v0 (wasm) is the
Expand All @@ -41,6 +41,7 @@ cfg_select! {
// - os=uefi
// - os=espidf
// - os=hermit
// - os=motor
// - nvptx64-nvidia-cuda
// - arch=avr
}
Expand Down
5 changes: 5 additions & 0 deletions library/unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ cfg_select! {
// no unwinder on the system!
// - os=none ("bare metal" targets)
// - os=hermit
// - os=motor
// - os=uefi
// - os=cuda
// - nvptx64-nvidia-cuda
Expand Down Expand Up @@ -215,6 +216,10 @@ cfg_select! {
#[link(name = "gcc_s")]
unsafe extern "C" {}

#[cfg(all(target_os = "wasi", panic = "unwind"))]
#[link(name = "unwind")]
unsafe extern "C" {}

#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
#[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
#[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
Expand Down
7 changes: 0 additions & 7 deletions library/unwind/src/libunwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ pub enum _Unwind_Context {}
all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
link(name = "unwind", kind = "static", modifiers = "-bundle")
)]
// Explicitly link the `unwind` library on WASI targets.
//
// This is provided in the self-contained sysroot for WASI targets by default.
// Note that Rust defaults to `-Cpanic=abort` on WASI targets meaning that this
// doesn't end up getting used by default, but this does mean that with
// `-Zbuild-std` this'll automatically link it in.
#[cfg_attr(target_os = "wasi", link(name = "unwind"))]
unsafe extern "C-unwind" {
pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
}
Expand Down
1 change: 0 additions & 1 deletion library/unwind/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ pub const unwinder_private_data_size: usize = cfg_select! {
target_arch = "s390x" => 2,
any(target_arch = "sparc", target_arch = "sparc64") => 2,
any(target_arch = "riscv64", target_arch = "riscv32") => 2,
all(target_family = "wasm", target_os = "emscripten") => 20,
target_family = "wasm" => 2,
target_arch = "hexagon" => 5,
any(target_arch = "loongarch32", target_arch = "loongarch64") => 2,
Expand Down
Loading