void-packages/srcpkgs/rust/patches/0005-Prefer-libgcc_eh-over-libunwind-for-musl.patch
2019-12-29 16:22:23 +01:00

65 lines
2.3 KiB
Diff

From 4f0e42ef109e688861abc33ae28dbb0bcba055aa Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 21 Dec 2019 16:49:07 +0100
Subject: [PATCH 05/18] Prefer libgcc_eh over libunwind for musl
+ @q66 changes to smaeul's original patch for Void's musl setup
---
src/libunwind/build.rs | 17 ++---------------
src/libunwind/lib.rs | 2 +-
2 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs
index b8db16f8..0c69b9d2 100644
--- a/src/libunwind/build.rs
+++ b/src/libunwind/build.rs
@@ -5,15 +5,11 @@ fn main() {
let target = env::var("TARGET").expect("TARGET was not set");
if cfg!(feature = "llvm-libunwind") &&
- ((target.contains("linux") && !target.contains("musl")) ||
- target.contains("fuchsia")) {
+ (target.contains("linux") || target.contains("fuchsia")) {
// Build the unwinding from libunwind C/C++ source code.
llvm_libunwind::compile();
} else if target.contains("linux") {
- if target.contains("musl") {
- // linking for musl is handled in lib.rs
- llvm_libunwind::compile();
- } else if !target.contains("android") {
+ if !target.contains("android") {
println!("cargo:rustc-link-lib=gcc_s");
}
} else if target.contains("freebsd") {
@@ -105,15 +101,6 @@ mod llvm_libunwind {
cfg.file(root.join("src").join(src));
}
- if target_env == "musl" {
- // use the same C compiler command to compile C++ code so we do not need to setup the
- // C++ compiler env variables on the builders
- cfg.cpp(false);
- // linking for musl is handled in lib.rs
- cfg.cargo_metadata(false);
- println!("cargo:rustc-link-search=native={}", env::var("OUT_DIR").unwrap());
- }
-
cfg.compile("unwind");
}
}
diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs
index 8d916447..6d653d41 100644
--- a/src/libunwind/lib.rs
+++ b/src/libunwind/lib.rs
@@ -21,7 +21,7 @@ cfg_if::cfg_if! {
}
#[cfg(target_env = "musl")]
-#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
+#[link(name = "gcc_eh", cfg(target_feature = "crt-static"))]
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
extern {}
--
2.24.0