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.
22 target_os = "solid_asp3",
23 all(target_vendor = "fortanix", target_env = "sgx"),
28 // no unwinder on the system!
29 // - wasm32 (not emscripten, which is "unix" family)
30 // - os=none ("bare metal" targets)
34 // - nvptx64-nvidia-cuda
35 // - Any new targets not listed above.
39 #[cfg(target_env = "musl")]
41 if #[cfg(all(feature = "llvm-libunwind", feature = "system-llvm-libunwind"))] {
42 compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time");
43 } else if #[cfg(feature = "llvm-libunwind")] {
44 #[link(name = "unwind", kind = "static", modifiers = "-bundle")]
46 } else if #[cfg(feature = "system-llvm-libunwind")] {
47 #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
48 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
51 #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
52 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
57 #[cfg(target_os = "android")]
59 if #[cfg(feature = "llvm-libunwind")] {
60 compile_error!("`llvm-libunwind` is not supported for Android targets");
61 } else if #[cfg(feature = "system-llvm-libunwind")] {
62 #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
63 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
66 #[link(name = "gcc", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
67 #[link(name = "gcc", cfg(not(target_feature = "crt-static")))]
71 // Android's unwinding library depends on dl_iterate_phdr in `libdl`.
72 #[cfg(target_os = "android")]
73 #[link(name = "dl", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
74 #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
77 // When building with crt-static, we get `gcc_eh` from the `libc` crate, since
78 // glibc needs it, and needs it listed later on the linker command line. We
79 // don't want to duplicate it here.
82 any(target_env = "gnu", target_env = "uclibc"),
83 not(feature = "llvm-libunwind"),
84 not(feature = "system-llvm-libunwind")
86 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
91 any(target_env = "gnu", target_env = "uclibc"),
92 not(feature = "llvm-libunwind"),
93 feature = "system-llvm-libunwind"
95 #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
98 #[cfg(target_os = "redox")]
99 #[link(name = "gcc_eh", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
100 #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
103 #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
104 #[link(name = "unwind", kind = "static", modifiers = "-bundle")]
107 #[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
108 #[link(name = "unwind", kind = "static", modifiers = "-bundle")]