diff options
| author | Josh Triplett <josh@joshtriplett.org> | 2020-09-20 21:19:34 -0700 |
|---|---|---|
| committer | Josh Triplett <josh@joshtriplett.org> | 2020-10-04 22:12:07 -0700 |
| commit | 9d952cbe953468be20bbe4404ffc55cb39bfb96e (patch) | |
| tree | c8c020db9fa8ef27dc2038eb870631c3776e6c18 | |
| parent | 16ebf750cfbc3de36cbf2e05eb50669d83c4dbfd (diff) | |
| download | rust-9d952cbe953468be20bbe4404ffc55cb39bfb96e.tar.gz rust-9d952cbe953468be20bbe4404ffc55cb39bfb96e.zip | |
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.
| -rw-r--r-- | library/unwind/build.rs | 4 | ||||
| -rw-r--r-- | library/unwind/src/lib.rs | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/library/unwind/build.rs b/library/unwind/build.rs index ab09a6e324d..24bcd40c3a8 100644 --- a/library/unwind/build.rs +++ b/library/unwind/build.rs @@ -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"); diff --git a/library/unwind/src/lib.rs b/library/unwind/src/lib.rs index 20a2ca98405..d34abb7e73d 100644 --- a/library/unwind/src/lib.rs +++ b/library/unwind/src/lib.rs @@ -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")))] |
