Skip to content

Commit

Permalink
Haiku: Adjust haiku target to match new librustc_back design
Browse files Browse the repository at this point in the history
  • Loading branch information
kallisti5 committed Sep 25, 2016
1 parent 8ec1d21 commit 7e91b86
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 26 deletions.
23 changes: 23 additions & 0 deletions src/librustc_back/target/haiku_base.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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()
}
}
23 changes: 10 additions & 13 deletions src/librustc_back/target/i686_unknown_haiku.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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,
})
}
1 change: 1 addition & 0 deletions src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 10 additions & 13 deletions src/librustc_back/target/x86_64_unknown_haiku.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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,
})
}

0 comments on commit 7e91b86

Please sign in to comment.