Skip to content

Commit

Permalink
Use link modifiers -bundle on musl and wasi target
Browse files Browse the repository at this point in the history
  • Loading branch information
12101111 committed Nov 3, 2021
1 parent d5401c9 commit fd331f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -26,7 +26,7 @@
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
#![cfg_attr(
any(feature = "rustc-dep-of-std", target_os = "redox"),
feature(static_nobundle)
feature(static_nobundle, native_link_modifiers, native_link_modifiers_bundle)
)]
#![cfg_attr(libc_const_extern_fn, feature(const_extern_fn))]

Expand Down
20 changes: 10 additions & 10 deletions src/unix/mod.rs
Expand Up @@ -305,21 +305,21 @@ cfg_if! {
} else if #[cfg(all(target_os = "linux",
any(target_env = "gnu", target_env = "uclibc"),
feature = "rustc-dep-of-std"))] {
#[link(name = "util", kind = "static-nobundle",
#[link(name = "util", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static"))]
#[link(name = "rt", kind = "static-nobundle",
#[link(name = "rt", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static"))]
#[link(name = "pthread", kind = "static-nobundle",
#[link(name = "pthread", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static"))]
#[link(name = "m", kind = "static-nobundle",
#[link(name = "m", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static"))]
#[link(name = "dl", kind = "static-nobundle",
#[link(name = "dl", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static"))]
#[link(name = "c", kind = "static-nobundle",
#[link(name = "c", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static"))]
#[link(name = "gcc_eh", kind = "static-nobundle",
#[link(name = "gcc_eh", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static"))]
#[link(name = "gcc", kind = "static-nobundle",
#[link(name = "gcc", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static"))]
#[link(name = "util", cfg(not(target_feature = "crt-static")))]
#[link(name = "rt", cfg(not(target_feature = "crt-static")))]
Expand All @@ -330,7 +330,7 @@ cfg_if! {
extern {}
} else if #[cfg(target_env = "musl")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static",
link(name = "c", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static")))]
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", cfg(not(target_feature = "crt-static"))))]
Expand Down Expand Up @@ -372,7 +372,7 @@ cfg_if! {
extern {}
} else if #[cfg(target_os = "redox")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static-nobundle",
link(name = "c", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static")))]
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", cfg(not(target_feature = "crt-static"))))]
Expand Down
7 changes: 6 additions & 1 deletion src/wasi.rs
Expand Up @@ -344,7 +344,12 @@ pub const _SC_SYMLOOP_MAX: c_int = 173;

#[cfg_attr(
feature = "rustc-dep-of-std",
link(name = "c", kind = "static", cfg(target_feature = "crt-static"))
link(
name = "c",
kind = "static",
modifiers = "-bundle",
cfg(target_feature = "crt-static")
)
)]
#[cfg_attr(
feature = "rustc-dep-of-std",
Expand Down

0 comments on commit fd331f6

Please sign in to comment.