aboutsummaryrefslogtreecommitdiffstats
path: root/community/rust/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
blob: 61a2d28e2cef96ddcbf67cdd01fa04be2aadc672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Additions for build.rs by q66, necessary for our musl setup.

From 1eb558f246269606c6d8d73824ef6b44fa10764e Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 9 Sep 2017 00:14:16 -0500
Subject: [PATCH 06/16] Prefer libgcc_eh over libunwind for musl

---
 src/libunwind/lib.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs
index 9182e349b19..0377fbb58fc 100644
--- a/src/libunwind/lib.rs
+++ b/src/libunwind/lib.rs
@@ -23,6 +23,6 @@ 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 {}
diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs
index f24d957..28828e5 100644
--- a/src/libunwind/build.rs
+++ b/src/libunwind/build.rs
@@ -5,15 +5,12 @@
     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 +102,6 @@
             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");
     }
 }