From 990b3c8d9d44318f174b8112cc6e377d28625967 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sun, 24 Jun 2018 13:12:18 +0200 Subject: [PATCH 1/3] Haiku: fix build of libbacktrace --- src/libstd/build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libstd/build.rs b/src/libstd/build.rs index c001e4e8cebf9..59789a0ae2dad 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -126,7 +126,8 @@ fn build_libbacktrace(target: &str) -> Result<(), ()> { if !target.contains("apple-ios") && !target.contains("solaris") && !target.contains("redox") && - !target.contains("android") { + !target.contains("android") && + !target.contains("haiku") { build.define("HAVE_DL_ITERATE_PHDR", "1"); } build.define("_GNU_SOURCE", "1"); From ecf4fe0b6f2e3aefdf3926d1196075c8394585b1 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Wed, 9 May 2018 17:31:41 +0000 Subject: [PATCH 2/3] Haiku: there is no setpriority on this platform. --- src/bootstrap/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index ae37d67e5d7bc..ea974111a0fde 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -177,7 +177,7 @@ mod toolstate; #[cfg(windows)] mod job; -#[cfg(unix)] +#[cfg(all(unix, not(target_os = "haiku")))] mod job { use libc; @@ -188,7 +188,7 @@ mod job { } } -#[cfg(not(any(unix, windows)))] +#[cfg(any(target_os = "haiku", not(any(unix, windows))))] mod job { pub unsafe fn setup(_build: &mut ::Build) { } From bbe45ce584436ea23aeb9aec5871f7813f8c7476 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 9 Jun 2018 14:08:45 +0000 Subject: [PATCH 3/3] Haiku: make it explicit that Haiku uses position independent executables on x86_64 With the switch to gcc 7 the linker scripts don't always explicitly add the `-pie` flag anymore. This creates build failures on x86_64. Interestingly enough, adding this flag on i686 will lead to executables that fail to run when ASLR is enabled, so let's keep it x86_64 only. --- src/librustc_target/spec/x86_64_unknown_haiku.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/librustc_target/spec/x86_64_unknown_haiku.rs b/src/librustc_target/spec/x86_64_unknown_haiku.rs index 1e78461861a95..68fa58b922019 100644 --- a/src/librustc_target/spec/x86_64_unknown_haiku.rs +++ b/src/librustc_target/spec/x86_64_unknown_haiku.rs @@ -16,6 +16,8 @@ pub fn target() -> TargetResult { base.max_atomic_width = Some(64); base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]); base.stack_probes = true; + // This option is required to build executables on Haiku x86_64 + base.position_independent_executables = true; Ok(Target { llvm_target: "x86_64-unknown-haiku".to_string(),