about summary refs log tree commit diff
path: root/src/librustc_back/target
diff options
context:
space:
mode:
authorSébastien Marie <semarie@users.noreply.github.com>2015-01-29 08:19:28 +0100
committerSébastien Marie <semarie@users.noreply.github.com>2015-02-01 14:41:38 +0100
commitfcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae (patch)
tree055fbf1fe9f0b9bd89481f29105fef90370d7789 /src/librustc_back/target
parentf1f9cb705df95171fce4e575374c959509e58dea (diff)
downloadrust-fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae.tar.gz
rust-fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae.zip
openbsd support
Diffstat (limited to 'src/librustc_back/target')
-rw-r--r--src/librustc_back/target/mod.rs4
-rw-r--r--src/librustc_back/target/openbsd_base.rs28
-rw-r--r--src/librustc_back/target/x86_64_unknown_openbsd.rs28
3 files changed, 60 insertions, 0 deletions
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 16adccfba57..1e787a35838 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -56,6 +56,7 @@ mod apple_base;
 mod apple_ios_base;
 mod freebsd_base;
 mod dragonfly_base;
+mod openbsd_base;
 
 mod armv7_apple_ios;
 mod armv7s_apple_ios;
@@ -80,6 +81,7 @@ mod x86_64_pc_windows_gnu;
 mod x86_64_unknown_freebsd;
 mod x86_64_unknown_dragonfly;
 mod x86_64_unknown_linux_gnu;
+mod x86_64_unknown_openbsd;
 
 /// Everything `rustc` knows about how to compile for a specific target.
 ///
@@ -352,6 +354,8 @@ impl Target {
             i686_unknown_dragonfly,
             x86_64_unknown_dragonfly,
 
+            x86_64_unknown_openbsd,
+
             x86_64_apple_darwin,
             i686_apple_darwin,
 
diff --git a/src/librustc_back/target/openbsd_base.rs b/src/librustc_back/target/openbsd_base.rs
new file mode 100644
index 00000000000..42220a87bd4
--- /dev/null
+++ b/src/librustc_back/target/openbsd_base.rs
@@ -0,0 +1,28 @@
+// 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,
+        morestack: false,
+        linker_is_gnu: true,
+        has_rpath: true,
+        pre_link_args: vec!(
+        ),
+        position_independent_executables: true,
+        .. Default::default()
+    }
+}
+
diff --git a/src/librustc_back/target/x86_64_unknown_openbsd.rs b/src/librustc_back/target/x86_64_unknown_openbsd.rs
new file mode 100644
index 00000000000..d2667dcd1dd
--- /dev/null
+++ b/src/librustc_back/target/x86_64_unknown_openbsd.rs
@@ -0,0 +1,28 @@
+// 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::Target;
+
+pub fn target() -> Target {
+    let mut base = super::openbsd_base::opts();
+    base.pre_link_args.push("-m64".to_string());
+
+    Target {
+        data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
+                     f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
+                     s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
+        llvm_target: "x86_64-unknown-openbsd".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "64".to_string(),
+        arch: "x86_64".to_string(),
+        target_os: "openbsd".to_string(),
+        options: base,
+    }
+}