Skip to content

Commit f2a74e2

Browse files
Rollup merge of rust-lang#119855 - rellerreller:freebsd-static, r=wesleywiser
Enable Static Builds for FreeBSD Enable crt-static for FreeBSD to enable statically compiled binaries.
2 parents dbf960a + adce3fd commit f2a74e2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/rustc_target/src/spec/base/freebsd.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub fn opts() -> TargetOptions {
66
dynamic_linking: true,
77
families: cvs!["unix"],
88
has_rpath: true,
9+
crt_static_respected: true,
910
position_independent_executables: true,
1011
relro_level: RelroLevel::Full,
1112
abi_return_struct_as_int: true,

library/unwind/src/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,16 @@ extern "C" {}
121121
#[link(name = "unwind", kind = "static", modifiers = "-bundle")]
122122
extern "C" {}
123123

124-
#[cfg(any(target_os = "freebsd", target_os = "netbsd"))]
124+
#[cfg(target_os = "netbsd")]
125125
#[link(name = "gcc_s")]
126126
extern "C" {}
127127

128+
#[cfg(target_os = "freebsd")]
129+
#[link(name = "gcc", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
130+
#[link(name = "gcc_eh", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
131+
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
132+
extern "C" {}
133+
128134
#[cfg(all(target_os = "openbsd", target_arch = "sparc64"))]
129135
#[link(name = "gcc")]
130136
extern "C" {}

0 commit comments

Comments
 (0)