Skip to content

Commit

Permalink
Auto merge of #2272 - 12101111:musl-bundle, r=Amanieu
Browse files Browse the repository at this point in the history
Use link modifiers -bundle on musl and wasi target

Implement rust-lang/rust#72274

Fix:

- rust-lang/wg-cargo-std-aware#66
- rust-lang/rust#89626

TODO:

- [x] Implement rustbuild side change: rust-lang/rust#90527
  • Loading branch information
bors committed Nov 4, 2021
2 parents 072d6de + fd331f6 commit 3bde54f
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,12 @@ pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =

#[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 3bde54f

Please sign in to comment.