Skip to content

Commit e06c875

Browse files
committed
Auto merge of #51757 - nielx:fix/haiku-fixes, r=nagisa
Haiku: several smaller fixes to build and run rust on Haiku This PR combines three small patches that help Rust build and run on the Haiku platform. These patches do not intend to impact other platforms.
2 parents 3ea16c3 + bbe45ce commit e06c875

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/bootstrap/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ mod toolstate;
178178
#[cfg(windows)]
179179
mod job;
180180

181-
#[cfg(unix)]
181+
#[cfg(all(unix, not(target_os = "haiku")))]
182182
mod job {
183183
use libc;
184184

@@ -189,7 +189,7 @@ mod job {
189189
}
190190
}
191191

192-
#[cfg(not(any(unix, windows)))]
192+
#[cfg(any(target_os = "haiku", not(any(unix, windows))))]
193193
mod job {
194194
pub unsafe fn setup(_build: &mut ::Build) {
195195
}

src/librustc_target/spec/x86_64_unknown_haiku.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ pub fn target() -> TargetResult {
1616
base.max_atomic_width = Some(64);
1717
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
1818
base.stack_probes = true;
19+
// This option is required to build executables on Haiku x86_64
20+
base.position_independent_executables = true;
1921

2022
Ok(Target {
2123
llvm_target: "x86_64-unknown-haiku".to_string(),

src/libstd/build.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ fn build_libbacktrace(target: &str) -> Result<(), ()> {
121121
if !target.contains("apple-ios") &&
122122
!target.contains("solaris") &&
123123
!target.contains("redox") &&
124-
!target.contains("android") {
124+
!target.contains("android") &&
125+
!target.contains("haiku") {
125126
build.define("HAVE_DL_ITERATE_PHDR", "1");
126127
}
127128
build.define("_GNU_SOURCE", "1");

0 commit comments

Comments
 (0)