about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorShawn Walker-Salas <shawn.walker@oracle.com>2017-02-16 21:19:43 -0800
committerShawn Walker-Salas <shawn.walker@oracle.com>2017-02-16 21:40:14 -0800
commit2e756e22b3d5ffcb9cf8b199796ecb35cfc7b415 (patch)
tree50b3ee502357f3b8912077327bf28c74c2149b92 /src
parent087c2337c156af2f7e408145737b2415e66693da (diff)
downloadrust-2e756e22b3d5ffcb9cf8b199796ecb35cfc7b415.tar.gz
rust-2e756e22b3d5ffcb9cf8b199796ecb35cfc7b415.zip
add solaris sparcv9 support
* Update bootstrap to recognize the cputype 'sparcv9' (used on Solaris)
* Change to never use -fomit-frame-pointer on Solaris or for sparc
* Adds rust target sparcv9-sun-solaris

Fixes #39901
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/bootstrap.py2
-rw-r--r--src/libcompiler_builtins/build.rs10
-rw-r--r--src/librustc_back/target/mod.rs1
-rw-r--r--src/librustc_back/target/sparcv9_sun_solaris.rs35
4 files changed, 47 insertions, 1 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index ee3f663dbd5..127369a4b77 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -416,6 +416,8 @@ class RustBuild(object):
             ostype += 'abi64'
         elif cputype in {'powerpc', 'ppc', 'ppc64'}:
             cputype = 'powerpc'
+        elif cputype == 'sparcv9':
+            pass
         elif cputype in {'amd64', 'x86_64', 'x86-64', 'x64'}:
             cputype = 'x86_64'
         else:
diff --git a/src/libcompiler_builtins/build.rs b/src/libcompiler_builtins/build.rs
index 5360bbdeacd..16ecf882566 100644
--- a/src/libcompiler_builtins/build.rs
+++ b/src/libcompiler_builtins/build.rs
@@ -92,7 +92,15 @@ fn main() {
         // compiler-rt's build system already
         cfg.flag("-fno-builtin");
         cfg.flag("-fvisibility=hidden");
-        cfg.flag("-fomit-frame-pointer");
+        // Accepted practice on Solaris is to never omit frame pointer so that
+        // system observability tools work as expected.  In addition, at least
+        // on Solaris, -fomit-frame-pointer on sparcv9 appears to generate
+        // references to data outside of the current stack frame.  A search of
+        // the gcc bug database provides a variety of issues surrounding
+        // -fomit-frame-pointer on non-x86 platforms.
+        if !target.contains("solaris") && !target.contains("sparc") {
+            cfg.flag("-fomit-frame-pointer");
+        }
         cfg.flag("-ffreestanding");
         cfg.define("VISIBILITY_HIDDEN", None);
     }
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 1d5d1e3ab2f..0c179469448 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -200,6 +200,7 @@ supported_targets! {
     ("armv7s-apple-ios", armv7s_apple_ios),
 
     ("x86_64-sun-solaris", x86_64_sun_solaris),
+    ("sparcv9-sun-solaris", sparcv9_sun_solaris),
 
     ("x86_64-pc-windows-gnu", x86_64_pc_windows_gnu),
     ("i686-pc-windows-gnu", i686_pc_windows_gnu),
diff --git a/src/librustc_back/target/sparcv9_sun_solaris.rs b/src/librustc_back/target/sparcv9_sun_solaris.rs
new file mode 100644
index 00000000000..c88e5a402f2
--- /dev/null
+++ b/src/librustc_back/target/sparcv9_sun_solaris.rs
@@ -0,0 +1,35 @@
+// Copyright 2016 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, TargetResult};
+
+pub fn target() -> TargetResult {
+    let mut base = super::solaris_base::opts();
+    base.pre_link_args.push("-m64".to_string());
+    // llvm calls this "v9"
+    base.cpu = "v9".to_string();
+    base.max_atomic_width = Some(64);
+
+    Ok(Target {
+        llvm_target: "sparcv9-sun-solaris".to_string(),
+        target_endian: "big".to_string(),
+        target_pointer_width: "64".to_string(),
+        data_layout: "E-m:e-i64:64-n32:64-S128".to_string(),
+        // Use "sparc64" instead of "sparcv9" here, since the former is already
+        // used widely in the source base.  If we ever needed ABI
+        // differentiation from the sparc64, we could, but that would probably
+        // just be confusing.
+        arch: "sparc64".to_string(),
+        target_os: "solaris".to_string(),
+        target_env: "".to_string(),
+        target_vendor: "sun".to_string(),
+        options: base,
+    })
+}