Skip to content

Commit c964567

Browse files
committed
Update libunwind dependencies for musl
Use libgcc_s when linking dynamically. Convert the static libunwind to static-nobundle, as libunwind.a is copied from musl_root and available in the library search path.
1 parent bab6911 commit c964567

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/libunwind/build.rs

+1-1
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

+6
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
#![feature(static_nobundle)]
@@ -28,3 +29,8 @@ extern crate libc;
2829
mod libunwind;
2930
#[cfg(not(target_env = "msvc"))]
3031
pub use libunwind::*;
32+
33+
#[cfg(target_env = "musl")]
34+
#[link(name = "unwind", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
35+
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
36+
extern {}

0 commit comments

Comments
 (0)