Skip to content

Commit 7e91b86

Browse files
committed
Haiku: Adjust haiku target to match new librustc_back design
1 parent 8ec1d21 commit 7e91b86

File tree

4 files changed

+44
-26
lines changed

4 files changed

+44
-26
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::TargetOptions;
12+
use std::default::Default;
13+
14+
pub fn opts() -> TargetOptions {
15+
TargetOptions {
16+
linker: "cc".to_string(),
17+
dynamic_linking: true,
18+
executables: true,
19+
has_rpath: true,
20+
linker_is_gnu: true,
21+
.. Default::default()
22+
}
23+
}

src/librustc_back/target/i686_unknown_haiku.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use target::Target;
12-
use target::TargetOptions;
13-
use std::default::Default;
11+
use target::{Target, TargetResult};
1412

15-
pub fn target() -> Target {
16-
Target {
13+
pub fn target() -> TargetResult {
14+
let mut base = super::haiku_base::opts();
15+
base.cpu = "pentium4".to_string();
16+
base.max_atomic_width = 64;
17+
base.pre_link_args.push("-m32".to_string());
18+
19+
Ok(Target {
1720
llvm_target: "i686-unknown-haiku".to_string(),
1821
target_endian: "little".to_string(),
1922
target_pointer_width: "32".to_string(),
@@ -22,12 +25,6 @@ pub fn target() -> Target {
2225
target_os: "haiku".to_string(),
2326
target_env: "".to_string(),
2427
target_vendor: "unknown".to_string(),
25-
options: TargetOptions {
26-
linker: "cc".to_string(),
27-
dynamic_linking: true,
28-
executables: true,
29-
has_rpath: true,
30-
.. Default::default()
31-
},
32-
}
28+
options: base,
29+
})
3330
}

src/librustc_back/target/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ mod apple_ios_base;
5656
mod bitrig_base;
5757
mod dragonfly_base;
5858
mod freebsd_base;
59+
mod haiku_base;
5960
mod linux_base;
6061
mod linux_musl_base;
6162
mod openbsd_base;

src/librustc_back/target/x86_64_unknown_haiku.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use target::Target;
12-
use target::TargetOptions;
13-
use std::default::Default;
11+
use target::{Target, TargetResult};
1412

15-
pub fn target() -> Target {
16-
Target {
13+
pub fn target() -> TargetResult {
14+
let mut base = super::haiku_base::opts();
15+
base.cpu = "x86-64".to_string();
16+
base.max_atomic_width = 64;
17+
base.pre_link_args.push("-m64".to_string());
18+
19+
Ok(Target {
1720
llvm_target: "x86_64-unknown-haiku".to_string(),
1821
target_endian: "little".to_string(),
1922
target_pointer_width: "64".to_string(),
@@ -22,12 +25,6 @@ pub fn target() -> Target {
2225
target_os: "haiku".to_string(),
2326
target_env: "".to_string(),
2427
target_vendor: "unknown".to_string(),
25-
options: TargetOptions {
26-
linker: "cc".to_string(),
27-
dynamic_linking: true,
28-
executables: true,
29-
has_rpath: true,
30-
.. Default::default()
31-
},
32-
}
28+
options: base,
29+
})
3330
}

0 commit comments

Comments
 (0)