about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-06 20:05:23 +0000
committerbors <bors@rust-lang.org>2018-07-06 20:05:23 +0000
commite06c875442e91cc2c597135d1e807a69e73eee26 (patch)
treeb68a271b1cd8f662d39b23e19c296b208c27335f
parent3ea16c3493d1ed7bb085053d4362907ee8d72366 (diff)
parentbbe45ce584436ea23aeb9aec5871f7813f8c7476 (diff)
downloadrust-e06c875442e91cc2c597135d1e807a69e73eee26.tar.gz
rust-e06c875442e91cc2c597135d1e807a69e73eee26.zip
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.
-rw-r--r--src/bootstrap/lib.rs4
-rw-r--r--src/librustc_target/spec/x86_64_unknown_haiku.rs2
-rw-r--r--src/libstd/build.rs3
3 files changed, 6 insertions, 3 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 168cbde7e0d..5f66d0b102e 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -178,7 +178,7 @@ mod toolstate;
 #[cfg(windows)]
 mod job;
 
-#[cfg(unix)]
+#[cfg(all(unix, not(target_os = "haiku")))]
 mod job {
     use libc;
 
@@ -189,7 +189,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) {
     }
diff --git a/src/librustc_target/spec/x86_64_unknown_haiku.rs b/src/librustc_target/spec/x86_64_unknown_haiku.rs
index 1e78461861a..68fa58b9220 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(),
diff --git a/src/libstd/build.rs b/src/libstd/build.rs
index 9d5aebde625..26d93f97e69 100644
--- a/src/libstd/build.rs
+++ b/src/libstd/build.rs
@@ -121,7 +121,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");