From fd331f65f214ea75b6210b415b5fd8650be15c73 Mon Sep 17 00:00:00 2001 From: 12101111 Date: Tue, 6 Jul 2021 01:03:50 +0800 Subject: [PATCH] Use link modifiers -bundle on musl and wasi target --- src/lib.rs | 2 +- src/unix/mod.rs | 20 ++++++++++---------- src/wasi.rs | 7 ++++++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 51e4811a83bdf..19fed28de264b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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))] diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 3ac1669b9a882..5ff2294e797c3 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -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")))] @@ -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"))))] @@ -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"))))] diff --git a/src/wasi.rs b/src/wasi.rs index f66ca92857955..de198c13870b2 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -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",