Skip to content

Commit 3a14de5

Browse files
committed
Link libgcc_s over libunwind on dynamic musl
1 parent b66c4ed commit 3a14de5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/libunwind/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn main() {
1616

1717
if target.contains("linux") {
1818
if target.contains("musl") && !target.contains("mips") {
19-
println!("cargo:rustc-link-lib=static=unwind");
19+
// musl is handled in lib.rs
2020
} else if !target.contains("android") {
2121
println!("cargo:rustc-link-lib=gcc_s");
2222
}

src/libunwind/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#![deny(warnings)]
1616

1717
#![feature(cfg_target_vendor)]
18+
#![feature(link_cfg)]
1819
#![feature(staged_api)]
1920
#![feature(unwind_attributes)]
2021

@@ -27,3 +28,8 @@ extern crate libc;
2728
mod libunwind;
2829
#[cfg(not(target_env = "msvc"))]
2930
pub use libunwind::*;
31+
32+
#[cfg(target_env = "musl")]
33+
#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
34+
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
35+
extern {}

0 commit comments

Comments
 (0)