about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-11-14 17:55:24 -0800
committerGitHub <noreply@github.com>2024-11-14 17:55:24 -0800
commitfcc084520c0a68cb031d2090f8f9e49b84e2fe06 (patch)
tree7573b947eb6bd60c7365c5df5790927dc53a5014
parentb1b56b11a2c1a2c08690e8424e98a14f1e251553 (diff)
parent467ce2695a9efca6f2494be680e922ac541df2e3 (diff)
downloadrust-fcc084520c0a68cb031d2090f8f9e49b84e2fe06.tar.gz
rust-fcc084520c0a68cb031d2090f8f9e49b84e2fe06.zip
Rollup merge of #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.
-rw-r--r--tests/ui/extern-flag/auxiliary/panic_handler.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/ui/extern-flag/auxiliary/panic_handler.rs b/tests/ui/extern-flag/auxiliary/panic_handler.rs
index 5ca32fa992b..9140ceed229 100644
--- a/tests/ui/extern-flag/auxiliary/panic_handler.rs
+++ b/tests/ui/extern-flag/auxiliary/panic_handler.rs
@@ -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<'_>) -> ! {