Skip to content

Commit

Permalink
Consolidate handling of libdl, and handle crt-static
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
joshtriplett committed Sep 20, 2020
1 parent e929f27 commit 74cfbfd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/unix/linux_like/linux/gnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,6 @@ extern "C" {
) -> ::c_int;
}

#[link(name = "dl")]
extern "C" {
pub fn dlmopen(
lmid: Lmid_t,
Expand Down
3 changes: 3 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ cfg_if! {
feature = "rustc-dep-of-std"))] {
#[link(name = "c", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "dl", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "m", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "pthread", kind = "static-nobundle",
Expand All @@ -312,6 +314,7 @@ cfg_if! {
#[link(name = "util", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
#[link(name = "m", cfg(not(target_feature = "crt-static")))]
#[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
#[link(name = "rt", cfg(not(target_feature = "crt-static")))]
Expand Down

0 comments on commit 74cfbfd

Please sign in to comment.