Skip to content

Commit

Permalink
Unrolled build for rust-lang#119855
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rust-timer authored Jan 18, 2024
2 parents 6ae4cfb + adce3fd commit 574d158
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/base/freebsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion library/unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" {}
Expand Down

0 comments on commit 574d158

Please sign in to comment.