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`.
This commit is contained in:
Josh Triplett 2020-09-19 20:46:25 -07:00
parent e005f4cad5
commit 5bf6ee5d8e
2 changed files with 3 additions and 1 deletions

View File

@ -1435,7 +1435,6 @@ extern "C" {
) -> ::c_int;
}
#[link(name = "dl")]
extern "C" {
pub fn dlmopen(
lmid: Lmid_t,

View File

@ -309,6 +309,8 @@ cfg_if! {
cfg(target_feature = "crt-static"))]
#[link(name = "m", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "dl", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "c", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "gcc_eh", kind = "static-nobundle",
@ -319,6 +321,7 @@ cfg_if! {
#[link(name = "rt", cfg(not(target_feature = "crt-static")))]
#[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
#[link(name = "m", cfg(not(target_feature = "crt-static")))]
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
extern {}
} else if #[cfg(target_env = "musl")] {