Skip to content

Commit 9d952cb

Browse files
committed
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.
1 parent 16ebf75 commit 9d952cb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

library/unwind/build.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ fn main() {
1212
} else if target.contains("x86_64-fortanix-unknown-sgx") {
1313
llvm_libunwind::compile();
1414
} else if target.contains("linux") {
15+
// linking for Linux is handled in lib.rs
1516
if target.contains("musl") {
16-
// linking for musl is handled in lib.rs
1717
llvm_libunwind::compile();
18-
} else if !target.contains("android") {
19-
println!("cargo:rustc-link-lib=gcc_s");
2018
}
2119
} else if target.contains("freebsd") {
2220
println!("cargo:rustc-link-lib=gcc_s");

library/unwind/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ cfg_if::cfg_if! {
4242
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
4343
extern "C" {}
4444

45+
#[cfg(all(target_os = "linux", target_env = "gnu", not(feature = "llvm-libunwind")))]
46+
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
47+
extern "C" {}
48+
4549
#[cfg(target_os = "redox")]
4650
#[link(name = "gcc_eh", kind = "static-nobundle", cfg(target_feature = "crt-static"))]
4751
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]

0 commit comments

Comments
 (0)