Skip to content

Commit

Permalink
unwind: Move linux-gnu library linking to lib.rs and libc
Browse files Browse the repository at this point in the history
This unifies it with the handling of `target-feature=+crt-static` on
other platforms, and allows for supporting static glibc in the future.
  • Loading branch information
joshtriplett committed Oct 5, 2020
1 parent 16ebf75 commit 9d952cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions library/unwind/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ fn main() {
} else if target.contains("x86_64-fortanix-unknown-sgx") {
llvm_libunwind::compile();
} else if target.contains("linux") {
// linking for Linux is handled in lib.rs
if target.contains("musl") {
// linking for musl is handled in lib.rs
llvm_libunwind::compile();
} else if !target.contains("android") {
println!("cargo:rustc-link-lib=gcc_s");
}
} else if target.contains("freebsd") {
println!("cargo:rustc-link-lib=gcc_s");
Expand Down
4 changes: 4 additions & 0 deletions library/unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ cfg_if::cfg_if! {
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
extern "C" {}

#[cfg(all(target_os = "linux", target_env = "gnu", not(feature = "llvm-libunwind")))]
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
extern "C" {}

#[cfg(target_os = "redox")]
#[link(name = "gcc_eh", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
Expand Down

0 comments on commit 9d952cb

Please sign in to comment.