Skip to content

Commit 8e65bdb

Browse files
committed
Consolidate handling of libdl, and handle crt-static
Move the link line for `libdl` up to `src/unix/mod.rs`, making it easier to see all the libraries `libc` links to. This also makes `libdl` respect `target-feature=+crt-static`.
1 parent 618b55b commit 8e65bdb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/unix/linux_like/linux/gnu/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,6 @@ extern "C" {
14351435
) -> ::c_int;
14361436
}
14371437

1438-
#[link(name = "dl")]
14391438
extern "C" {
14401439
pub fn dlmopen(
14411440
lmid: Lmid_t,

src/unix/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,15 @@ cfg_if! {
309309
cfg(target_feature = "crt-static"))]
310310
#[link(name = "m", kind = "static-nobundle",
311311
cfg(target_feature = "crt-static"))]
312+
#[link(name = "dl", kind = "static-nobundle",
313+
cfg(target_feature = "crt-static"))]
312314
#[link(name = "c", kind = "static-nobundle",
313315
cfg(target_feature = "crt-static"))]
314316
#[link(name = "util", cfg(not(target_feature = "crt-static")))]
315317
#[link(name = "rt", cfg(not(target_feature = "crt-static")))]
316318
#[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
317319
#[link(name = "m", cfg(not(target_feature = "crt-static")))]
320+
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
318321
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
319322
extern {}
320323
} else if #[cfg(target_env = "musl")] {

0 commit comments

Comments
 (0)