2 #![unstable(feature = "panic_unwind", issue = "32837")]
4 #![feature(staged_api)]
6 #![feature(cfg_target_abi)]
7 #![cfg_attr(not(target_env = "msvc"), feature(libc))]
10 if #[cfg(target_env = "msvc")] {
11 // Windows MSVC no extra unwinder support needed
17 // These "unix" family members do not have unwinder.
18 // Note this also matches x86_64-unknown-none-linuxkernel.
23 target_os = "solid_asp3",
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", modifiers = "-bundle")]
47 } else if #[cfg(feature = "system-llvm-libunwind")] {
48 #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
49 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
52 #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
53 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
58 #[cfg(target_os = "android")]
60 if #[cfg(feature = "llvm-libunwind")] {
61 compile_error!("`llvm-libunwind` is not supported for Android targets");
62 } else if #[cfg(feature = "system-llvm-libunwind")] {
63 #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
64 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
67 #[link(name = "gcc", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
68 #[link(name = "gcc", cfg(not(target_feature = "crt-static")))]
72 // Android's unwinding library depends on dl_iterate_phdr in `libdl`.
73 #[cfg(target_os = "android")]
74 #[link(name = "dl", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
75 #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
78 // When building with crt-static, we get `gcc_eh` from the `libc` crate, since
79 // glibc needs it, and needs it listed later on the linker command line. We
80 // don't want to duplicate it here.
83 any(target_env = "gnu", target_env = "uclibc"),
84 not(feature = "llvm-libunwind"),
85 not(feature = "system-llvm-libunwind")
87 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
92 any(target_env = "gnu", target_env = "uclibc"),
93 not(feature = "llvm-libunwind"),
94 feature = "system-llvm-libunwind"
96 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
99 #[cfg(target_os = "redox")]
100 #[link(name = "gcc_eh", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
101 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
104 #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
105 #[link(name = "unwind", kind = "static", modifiers = "-bundle")]
108 #[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
109 #[link(name = "unwind", kind = "static", modifiers = "-bundle")]