Skip to content

Commit

Permalink
Unrolled build for rust-lang#132905
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#132905 - xingxue-ibm:link-unwind, r=bjorn3

[AIX] Add crate "unwind" to link with libunwind

The Rust on IBM AIX uses LLVM's `libunwind`. Since crate `unwind` is a dependency of crate `std` and `#![no_std]` is specified in the test case, `libunwind` is not included in the link command by default. As a result, the test case fails to link with the error "Undefined symbol: ._Unwind_Resume" on AIX. This PR explicitly adds crate `unwind` for AIX, along with feature `panic_unwind`, which is required to include the `unwind` crate.
  • Loading branch information
rust-timer authored Nov 15, 2024
2 parents 3bc6916 + 467ce26 commit cfc257d
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 cfc257d

Please sign in to comment.