Skip to content

Commit

Permalink
Update libunwind dependencies for musl
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
smaeul committed Aug 22, 2017
1 parent bab6911 commit c964567
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libunwind/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fn main() {

if target.contains("linux") {
if target.contains("musl") && !target.contains("mips") {
println!("cargo:rustc-link-lib=static=unwind");
// musl is handled in lib.rs
} else if !target.contains("android") {
println!("cargo:rustc-link-lib=gcc_s");
}
Expand Down
6 changes: 6 additions & 0 deletions src/libunwind/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![deny(warnings)]

#![feature(cfg_target_vendor)]
#![feature(link_cfg)]
#![feature(staged_api)]
#![feature(unwind_attributes)]
#![feature(static_nobundle)]
Expand All @@ -28,3 +29,8 @@ extern crate libc;
mod libunwind;
#[cfg(not(target_env = "msvc"))]
pub use libunwind::*;

#[cfg(target_env = "musl")]
#[link(name = "unwind", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
extern {}

0 comments on commit c964567

Please sign in to comment.