]> git.lizzy.rs Git - rust.git/blob - library/unwind/src/lib.rs
Rollup merge of #79211 - yoshuawuyts:future-doc-alias, r=Mark-Simulacrum
[rust.git] / library / unwind / src / lib.rs
1 #![no_std]
2 #![unstable(feature = "panic_unwind", issue = "32837")]
3 #![feature(link_cfg)]
4 #![feature(nll)]
5 #![feature(staged_api)]
6 #![feature(unwind_attributes)]
7 #![feature(static_nobundle)]
8 #![cfg_attr(not(target_env = "msvc"), feature(libc))]
9
10 cfg_if::cfg_if! {
11     if #[cfg(target_env = "msvc")] {
12         // Windows MSVC no extra unwinder support needed
13     } else if #[cfg(any(
14         target_os = "l4re",
15         target_os = "none",
16     ))] {
17         // These "unix" family members do not have unwinder.
18         // Note this also matches x86_64-linux-kernel.
19     } else if #[cfg(any(
20         unix,
21         windows,
22         target_os = "psp",
23         all(target_vendor = "fortanix", target_env = "sgx"),
24     ))] {
25         mod libunwind;
26         pub use libunwind::*;
27     } else {
28         // no unwinder on the system!
29         // - wasm32 (not emscripten, which is "unix" family)
30         // - os=none ("bare metal" targets)
31         // - os=hermit
32         // - os=uefi
33         // - os=cuda
34         // - nvptx64-nvidia-cuda
35         // - Any new targets not listed above.
36     }
37 }
38
39 #[cfg(target_env = "musl")]
40 #[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
41 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
42 extern "C" {}
43
44 // When building with crt-static, we get `gcc_eh` from the `libc` crate, since
45 // glibc needs it, and needs it listed later on the linker command line. We
46 // don't want to duplicate it here.
47 #[cfg(all(
48     target_os = "linux",
49     target_env = "gnu",
50     not(feature = "llvm-libunwind"),
51     not(feature = "system-llvm-libunwind")
52 ))]
53 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
54 extern "C" {}
55
56 #[cfg(all(
57     target_os = "linux",
58     target_env = "gnu",
59     not(feature = "llvm-libunwind"),
60     feature = "system-llvm-libunwind"
61 ))]
62 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
63 extern "C" {}
64
65 #[cfg(target_os = "redox")]
66 #[link(name = "gcc_eh", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
67 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
68 extern "C" {}
69
70 #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
71 #[link(name = "unwind", kind = "static-nobundle")]
72 extern "C" {}