Skip to content

Commit

Permalink
Include the "unwind" crate to link with libunwind instead of the "lib…
Browse files Browse the repository at this point in the history
…c" crate.
  • Loading branch information
xingxue-ibm committed Nov 14, 2024
1 parent 71042b4 commit 467ce26
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tests/ui/extern-flag/auxiliary/panic_handler.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#![feature(lang_items)]
#![feature(lang_items, panic_unwind)]
#![no_std]

// Since `rustc` generally passes `-nodefaultlibs` to the linker,
// Rust programs link necessary system libraries via `#[link()]`
// attributes in the `libc` crate. `libc` is a dependency of `std`,
// but as we are `#![no_std]`, we need to include it manually.
// Except on windows-msvc.
#![feature(rustc_private)]
#[cfg(not(all(windows, target_env = "msvc")))]
extern crate libc;
// Since the `unwind` crate is a dependency of the `std` crate, and we have
// `#![no_std]`, the unwinder is not included in the link command by default.
// We need to include crate `unwind` manually.
extern crate unwind;

#[panic_handler]
pub fn begin_panic_handler(_info: &core::panic::PanicInfo<'_>) -> ! {
Expand Down

0 comments on commit 467ce26

Please sign in to comment.