Rollup merge of #119855 - rellerreller:freebsd-static, r=wesleywiser

Enable Static Builds for FreeBSD

Enable crt-static for FreeBSD to enable statically compiled binaries.
This commit is contained in:
Matthias Krüger 2024-01-17 20:21:19 +01:00 committed by GitHub
commit c9779afc9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,7 @@ pub fn opts() -> TargetOptions {
dynamic_linking: true,
families: cvs!["unix"],
has_rpath: true,
crt_static_respected: true,
position_independent_executables: true,
relro_level: RelroLevel::Full,
abi_return_struct_as_int: true,

View File

@ -121,10 +121,16 @@ extern "C" {}
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
extern "C" {}
#[cfg(any(target_os = "freebsd", target_os = "netbsd"))]
#[cfg(target_os = "netbsd")]
#[link(name = "gcc_s")]
extern "C" {}
#[cfg(target_os = "freebsd")]
#[link(name = "gcc", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
#[link(name = "gcc_eh", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
extern "C" {}
#[cfg(all(target_os = "openbsd", target_arch = "sparc64"))]
#[link(name = "gcc")]
extern "C" {}