summaryrefslogtreecommitdiffstats
path: root/library/unwind
diff options
context:
space:
mode:
Diffstat (limited to 'library/unwind')
-rw-r--r--library/unwind/Cargo.toml4
-rw-r--r--library/unwind/build.rs24
-rw-r--r--library/unwind/src/lib.rs25
-rw-r--r--library/unwind/src/libunwind.rs17
4 files changed, 37 insertions, 33 deletions
diff --git a/library/unwind/Cargo.toml b/library/unwind/Cargo.toml
index 69fce8d77..eab2717c4 100644
--- a/library/unwind/Cargo.toml
+++ b/library/unwind/Cargo.toml
@@ -17,10 +17,10 @@ doc = false
core = { path = "../core" }
libc = { version = "0.2.79", features = ['rustc-dep-of-std'], default-features = false }
compiler_builtins = "0.1.0"
-cfg-if = "0.1.8"
+cfg-if = "1.0"
[build-dependencies]
-cc = "1.0.69"
+cc = "1.0.76"
[features]
diff --git a/library/unwind/build.rs b/library/unwind/build.rs
index 31af39025..5c3c02fb6 100644
--- a/library/unwind/build.rs
+++ b/library/unwind/build.rs
@@ -21,29 +21,5 @@ fn main() {
if has_unwind {
println!("cargo:rustc-cfg=feature=\"system-llvm-libunwind\"");
}
- } else if target.contains("freebsd") {
- println!("cargo:rustc-link-lib=gcc_s");
- } else if target.contains("netbsd") {
- println!("cargo:rustc-link-lib=gcc_s");
- } else if target.contains("openbsd") {
- if target.contains("sparc64") {
- println!("cargo:rustc-link-lib=gcc");
- } else {
- println!("cargo:rustc-link-lib=c++abi");
- }
- } else if target.contains("solaris") {
- println!("cargo:rustc-link-lib=gcc_s");
- } else if target.contains("illumos") {
- println!("cargo:rustc-link-lib=gcc_s");
- } else if target.contains("dragonfly") {
- println!("cargo:rustc-link-lib=gcc_pic");
- } else if target.ends_with("pc-windows-gnu") {
- // This is handled in the target spec with late_link_args_[static|dynamic]
- } else if target.contains("uwp-windows-gnu") {
- println!("cargo:rustc-link-lib=unwind");
- } else if target.contains("haiku") {
- println!("cargo:rustc-link-lib=gcc_s");
- } else if target.contains("redox") {
- // redox is handled in lib.rs
}
}
diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs
index 46fe50cb9..3753071d5 100644
--- a/library/unwind/src/lib.rs
+++ b/library/unwind/src/lib.rs
@@ -15,7 +15,6 @@ cfg_if::cfg_if! {
target_os = "espidf",
))] {
// These "unix" family members do not have unwinder.
- // Note this also matches x86_64-unknown-none-linuxkernel.
} else if #[cfg(any(
unix,
windows,
@@ -105,6 +104,26 @@ extern "C" {}
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
extern "C" {}
-#[cfg(all(target_os = "windows", target_env = "gnu", target_abi = "llvm"))]
-#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
+#[cfg(any(target_os = "freebsd", target_os = "netbsd"))]
+#[link(name = "gcc_s")]
+extern "C" {}
+
+#[cfg(all(target_os = "openbsd", target_arch = "sparc64"))]
+#[link(name = "gcc")]
+extern "C" {}
+
+#[cfg(all(target_os = "openbsd", not(target_arch = "sparc64")))]
+#[link(name = "c++abi")]
+extern "C" {}
+
+#[cfg(any(target_os = "solaris", target_os = "illumos"))]
+#[link(name = "gcc_s")]
+extern "C" {}
+
+#[cfg(target_os = "dragonfly")]
+#[link(name = "gcc_pic")]
+extern "C" {}
+
+#[cfg(target_os = "haiku")]
+#[link(name = "gcc_s")]
extern "C" {}
diff --git a/library/unwind/src/libunwind.rs b/library/unwind/src/libunwind.rs
index a5b6193b0..0fa11f376 100644
--- a/library/unwind/src/libunwind.rs
+++ b/library/unwind/src/libunwind.rs
@@ -27,7 +27,10 @@ pub type _Unwind_Trace_Fn =
#[cfg(target_arch = "x86")]
pub const unwinder_private_data_size: usize = 5;
-#[cfg(target_arch = "x86_64")]
+#[cfg(all(target_arch = "x86_64", not(target_os = "windows")))]
+pub const unwinder_private_data_size: usize = 2;
+
+#[cfg(all(target_arch = "x86_64", target_os = "windows"))]
pub const unwinder_private_data_size: usize = 6;
#[cfg(all(target_arch = "arm", not(any(target_os = "ios", target_os = "watchos"))))]
@@ -36,9 +39,12 @@ pub const unwinder_private_data_size: usize = 20;
#[cfg(all(target_arch = "arm", any(target_os = "ios", target_os = "watchos")))]
pub const unwinder_private_data_size: usize = 5;
-#[cfg(all(target_arch = "aarch64", target_pointer_width = "64"))]
+#[cfg(all(target_arch = "aarch64", target_pointer_width = "64", not(target_os = "windows")))]
pub const unwinder_private_data_size: usize = 2;
+#[cfg(all(target_arch = "aarch64", target_pointer_width = "64", target_os = "windows"))]
+pub const unwinder_private_data_size: usize = 6;
+
#[cfg(all(target_arch = "aarch64", target_pointer_width = "32"))]
pub const unwinder_private_data_size: usize = 5;
@@ -90,7 +96,10 @@ pub type _Unwind_Exception_Cleanup_Fn =
// rustc_codegen_ssa::src::back::symbol_export, rustc_middle::middle::exported_symbols
// and RFC 2841
#[cfg_attr(
- all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
+ any(
+ all(feature = "llvm-libunwind", any(target_os = "fuchsia", target_os = "linux")),
+ all(target_os = "windows", target_env = "gnu", target_abi = "llvm")
+ ),
link(name = "unwind", kind = "static", modifiers = "-bundle")
)]
extern "C-unwind" {
@@ -269,7 +278,7 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
} // cfg_if!
cfg_if::cfg_if! {
-if #[cfg(all(windows, target_arch = "x86_64", target_env = "gnu"))] {
+if #[cfg(all(windows, any(target_arch = "aarch64", target_arch = "x86_64"), target_env = "gnu"))] {
// We declare these as opaque types. This is fine since you just need to
// pass them to _GCC_specific_handler and forget about them.
pub enum EXCEPTION_RECORD {}