diff --git a/src/librustc_back/target/haiku_base.rs b/src/librustc_back/target/haiku_base.rs new file mode 100644 index 00000000000..5e319ba1838 --- /dev/null +++ b/src/librustc_back/target/haiku_base.rs @@ -0,0 +1,23 @@ +// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use target::TargetOptions; +use std::default::Default; + +pub fn opts() -> TargetOptions { + TargetOptions { + linker: "cc".to_string(), + dynamic_linking: true, + executables: true, + has_rpath: true, + linker_is_gnu: true, + .. Default::default() + } +} diff --git a/src/librustc_back/target/i686_unknown_haiku.rs b/src/librustc_back/target/i686_unknown_haiku.rs index 6ec4e750ded..862016704f4 100644 --- a/src/librustc_back/target/i686_unknown_haiku.rs +++ b/src/librustc_back/target/i686_unknown_haiku.rs @@ -8,12 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use target::Target; -use target::TargetOptions; -use std::default::Default; +use target::{Target, TargetResult}; -pub fn target() -> Target { - Target { +pub fn target() -> TargetResult { + let mut base = super::haiku_base::opts(); + base.cpu = "pentium4".to_string(); + base.max_atomic_width = 64; + base.pre_link_args.push("-m32".to_string()); + + Ok(Target { llvm_target: "i686-unknown-haiku".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), @@ -22,12 +25,6 @@ pub fn target() -> Target { target_os: "haiku".to_string(), target_env: "".to_string(), target_vendor: "unknown".to_string(), - options: TargetOptions { - linker: "cc".to_string(), - dynamic_linking: true, - executables: true, - has_rpath: true, - .. Default::default() - }, - } + options: base, + }) } diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 493466c25e0..087078021a1 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -56,6 +56,7 @@ mod apple_ios_base; mod bitrig_base; mod dragonfly_base; mod freebsd_base; +mod haiku_base; mod linux_base; mod linux_musl_base; mod openbsd_base; diff --git a/src/librustc_back/target/x86_64_unknown_haiku.rs b/src/librustc_back/target/x86_64_unknown_haiku.rs index 2bcd8af2888..171e88cee50 100644 --- a/src/librustc_back/target/x86_64_unknown_haiku.rs +++ b/src/librustc_back/target/x86_64_unknown_haiku.rs @@ -8,12 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use target::Target; -use target::TargetOptions; -use std::default::Default; +use target::{Target, TargetResult}; -pub fn target() -> Target { - Target { +pub fn target() -> TargetResult { + let mut base = super::haiku_base::opts(); + base.cpu = "x86-64".to_string(); + base.max_atomic_width = 64; + base.pre_link_args.push("-m64".to_string()); + + Ok(Target { llvm_target: "x86_64-unknown-haiku".to_string(), target_endian: "little".to_string(), target_pointer_width: "64".to_string(), @@ -22,12 +25,6 @@ pub fn target() -> Target { target_os: "haiku".to_string(), target_env: "".to_string(), target_vendor: "unknown".to_string(), - options: TargetOptions { - linker: "cc".to_string(), - dynamic_linking: true, - executables: true, - has_rpath: true, - .. Default::default() - }, - } + options: base, + }) }