about summary refs log tree commit diff
path: root/src/librustc_back/target
diff options
context:
space:
mode:
authorNikita Baksalyar <nikita.baksalyar@gmail.com>2016-01-21 19:30:22 +0300
committerNikita Baksalyar <nikita.baksalyar@gmail.com>2016-01-31 18:57:26 +0300
commitf189d7a6937c063f9592136a39c836b17c008a93 (patch)
treea31b16fa2af96d112a2e470d7a169b460d961efb /src/librustc_back/target
parent9041b930585806b948b4cc68933047ffdc96f6f9 (diff)
downloadrust-f189d7a6937c063f9592136a39c836b17c008a93.tar.gz
rust-f189d7a6937c063f9592136a39c836b17c008a93.zip
Add Illumos support
Diffstat (limited to 'src/librustc_back/target')
-rw-r--r--src/librustc_back/target/mod.rs8
-rw-r--r--src/librustc_back/target/sunos_base.rs26
-rw-r--r--src/librustc_back/target/x86_64_sun_solaris.rs29
3 files changed, 63 insertions, 0 deletions
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 39f05ba645e..f47aeaa0f21 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -59,6 +59,7 @@ mod freebsd_base;
 mod linux_base;
 mod openbsd_base;
 mod netbsd_base;
+mod sunos_base;
 mod windows_base;
 mod windows_msvc_base;
 
@@ -155,6 +156,10 @@ pub struct TargetOptions {
     /// Whether the target toolchain is like OSX's. Only useful for compiling against iOS/OS X, in
     /// particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
     pub is_like_osx: bool,
+    /// Whether the target toolchain is like Solaris's.
+    /// Only useful for compiling against Illumos/Solaris,
+    /// as they have a different set of linker flags. Defaults to false.
+    pub is_like_sunos: bool,
     /// Whether the target toolchain is like Windows'. Only useful for compiling against Windows,
     /// only really used for figuring out how to find libraries, since Windows uses its own
     /// library naming convention. Defaults to false.
@@ -227,6 +232,7 @@ impl Default for TargetOptions {
             staticlib_suffix: ".a".to_string(),
             target_family: None,
             is_like_osx: false,
+            is_like_sunos: false,
             is_like_windows: false,
             is_like_android: false,
             is_like_msvc: false,
@@ -447,6 +453,8 @@ impl Target {
             armv7_apple_ios,
             armv7s_apple_ios,
 
+            x86_64_sun_solaris,
+
             x86_64_pc_windows_gnu,
             i686_pc_windows_gnu,
 
diff --git a/src/librustc_back/target/sunos_base.rs b/src/librustc_back/target/sunos_base.rs
new file mode 100644
index 00000000000..52052be0198
--- /dev/null
+++ b/src/librustc_back/target/sunos_base.rs
@@ -0,0 +1,26 @@
+// 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,
+        is_like_sunos: true,
+        archive_format: "gnu".to_string(),
+        exe_allocation_crate: super::maybe_jemalloc(),
+
+        .. Default::default()
+    }
+}
diff --git a/src/librustc_back/target/x86_64_sun_solaris.rs b/src/librustc_back/target/x86_64_sun_solaris.rs
new file mode 100644
index 00000000000..a18aa0277e1
--- /dev/null
+++ b/src/librustc_back/target/x86_64_sun_solaris.rs
@@ -0,0 +1,29 @@
+// 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::sunos_base::opts();
+    base.pre_link_args.push("-m64".to_string());
+    base.pre_link_args.push("-lsocket".to_string());
+    base.pre_link_args.push("-lposix4".to_string());
+
+    Target {
+        llvm_target: "x86_64-pc-solaris2.11".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "64".to_string(),
+        arch: "x86_64".to_string(),
+        target_os: "sunos".to_string(),
+        target_env: "".to_string(),
+        target_vendor: "sun".to_string(),
+        options: base,
+    }
+}