unwind: Move linux-gnu library linking to lib.rs and libc

This unifies it with the handling of `target-feature=+crt-static` on
other platforms, and allows for supporting static glibc in the future.
This commit is contained in:
Josh Triplett 2020-09-20 21:19:34 -07:00
parent 16ebf750cf
commit 9d952cbe95
2 changed files with 5 additions and 3 deletions

View File

@ -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");

View File

@ -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")))]