2 #![unstable(feature = "panic_unwind", issue = "32837")]
5 #![feature(staged_api)]
6 #![feature(static_nobundle)]
8 #![cfg_attr(not(target_env = "msvc"), feature(libc))]
11 if #[cfg(target_env = "msvc")] {
12 // Windows MSVC no extra unwinder support needed
18 // These "unix" family members do not have unwinder.
19 // Note this also matches x86_64-unknown-none-linuxkernel.
24 all(target_vendor = "fortanix", target_env = "sgx"),
29 // no unwinder on the system!
30 // - wasm32 (not emscripten, which is "unix" family)
31 // - os=none ("bare metal" targets)
35 // - nvptx64-nvidia-cuda
36 // - Any new targets not listed above.
40 #[cfg(target_env = "musl")]
42 if #[cfg(all(feature = "llvm-libunwind", feature = "system-llvm-libunwind"))] {
43 compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time");
44 } else if #[cfg(feature = "llvm-libunwind")] {
45 #[link(name = "unwind", kind = "static")]
47 } else if #[cfg(feature = "system-llvm-libunwind")] {
48 #[link(name = "unwind", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
49 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
52 #[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
53 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
58 // When building with crt-static, we get `gcc_eh` from the `libc` crate, since
59 // glibc needs it, and needs it listed later on the linker command line. We
60 // don't want to duplicate it here.
64 not(feature = "llvm-libunwind"),
65 not(feature = "system-llvm-libunwind")
67 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
73 not(feature = "llvm-libunwind"),
74 feature = "system-llvm-libunwind"
76 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
79 #[cfg(target_os = "redox")]
80 #[link(name = "gcc_eh", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
81 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
84 #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
85 #[link(name = "unwind", kind = "static")]