Skip to content

Commit a676ef2

Browse files
committed
Include the panic_unwind feature and specify the unwind crate unconditionally and remove the libc crate.
1 parent 3a68be8 commit a676ef2

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

tests/ui/extern-flag/auxiliary/panic_handler.rs

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
1-
#![feature(lang_items)]
1+
#![feature(lang_items, panic_unwind)]
22
#![no_std]
3-
#![cfg_attr(target_os = "aix", feature(panic_unwind))]
43

5-
// Since `rustc` generally passes `-nodefaultlibs` to the linker,
6-
// Rust programs link necessary system libraries via `#[link()]`
7-
// attributes in the `libc` crate. `libc` is a dependency of `std`,
8-
// but as we are `#![no_std]`, we need to include it manually.
9-
// Except on windows-msvc.
10-
#![feature(rustc_private)]
11-
#[cfg(not(all(windows, target_env = "msvc")))]
12-
extern crate libc;
13-
14-
// Since crate `unwind` is a dependency of crate `std`, and we are using
15-
// `#![no_std]`, `libunwind` is not included in the link command on AIX
16-
// by default. We need to include crate `unwind` manually.
17-
#[cfg(target_os = "aix")]
4+
// Since the `unwind` crate is a dependency of the `std` crate, and we have
5+
// `#![no_std]`, the unwinder is not included in the link command by default.
6+
// We need to include crate `unwind` manually.
187
extern crate unwind;
198

209
#[panic_handler]

tests/ui/runtime/signal-alternate-stack-cleanup.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ fn main() {
2929
// Install signal handler that runs on alternate signal stack.
3030
let mut action: sigaction = std::mem::zeroed();
3131
action.sa_flags = (SA_ONSTACK | SA_SIGINFO) as _;
32-
action.sa_sigaction = signal_handler as sighandler_t;
32+
#[cfg(not(target_os = "aix"))]
33+
{ action.sa_sigaction = signal_handler as sighandler_t}
34+
#[cfg(target_os = "aix")]
35+
{ action.sa_union.__su_sigaction = signal_handler as sighandler_t }
3336
sigaction(SIGWINCH, &action, std::ptr::null_mut());
3437

3538
// Send SIGWINCH on exit.

0 commit comments

Comments
 (0)