Skip to content

Commit 5fdf436

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 b218b95 commit 5fdf436

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

library/unwind/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ doc = false
1414

1515
[dependencies]
1616
core = { path = "../core" }
17-
libc = { version = "0.2.51", features = ['rustc-dep-of-std'], default-features = false }
17+
libc = { version = "0.2.78", features = ['rustc-dep-of-std'], default-features = false }
1818
compiler_builtins = "0.1.0"
1919
cfg-if = "0.1.8"
2020

library/unwind/build.rs

Lines changed: 1 addition & 3 deletions
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

Lines changed: 4 additions & 0 deletions
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)