File tree 2 files changed +8
-16
lines changed
2 files changed +8
-16
lines changed Original file line number Diff line number Diff line change 1
- #![ feature( lang_items) ]
1
+ #![ feature( lang_items, panic_unwind ) ]
2
2
#![ no_std]
3
- #![ cfg_attr( target_os = "aix" , feature( panic_unwind) ) ]
4
3
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.
18
7
extern crate unwind;
19
8
20
9
#[ panic_handler]
Original file line number Diff line number Diff line change @@ -29,7 +29,10 @@ fn main() {
29
29
// Install signal handler that runs on alternate signal stack.
30
30
let mut action: sigaction = std:: mem:: zeroed ( ) ;
31
31
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 }
33
36
sigaction ( SIGWINCH , & action, std:: ptr:: null_mut ( ) ) ;
34
37
35
38
// Send SIGWINCH on exit.
You can’t perform that action at this time.
0 commit comments