Add Fuchsia support

Adds support for the x86_64-unknown-fuchsia target, which covers the
Fuchsia operating system.
This commit is contained in:
Raph Levien 2016-10-18 13:43:18 -07:00
parent 4879166194
commit 76bac5d33e
21 changed files with 548 additions and 38 deletions

View file

@ -0,0 +1,39 @@
// Copyright 2014 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 {
dynamic_linking: true,
executables: true,
linker_is_gnu: true,
has_rpath: true,
pre_link_args: vec![
// We want to be able to strip as much executable code as possible
// from the linker command line, and this flag indicates to the
// linker that it can avoid linking in dynamic libraries that don't
// actually satisfy any symbols up to that point (as with many other
// resolutions the linker does). This option only applies to all
// following libraries so we're sure to pass it as one of the first
// arguments.
// TODO: doesn't seem to be supported by clang toolchain
//"-Wl,--as-needed".to_string(),
// Always enable NX protection when it is available
//"-Wl,-z,noexecstack".to_string(),
],
position_independent_executables: true,
exe_allocation_crate: "alloc_system".to_string(),
has_elf_tls: true,
.. Default::default()
}
}

View file

@ -67,6 +67,7 @@ mod solaris_base;
mod windows_base;
mod windows_msvc_base;
mod thumb_base;
mod fuchsia_base;
pub type TargetResult = Result<Target, String>;
@ -175,6 +176,8 @@ supported_targets! {
("x86_64-apple-darwin", x86_64_apple_darwin),
("i686-apple-darwin", i686_apple_darwin),
("x86_64-unknown-fuchsia", x86_64_unknown_fuchsia),
("i386-apple-ios", i386_apple_ios),
("x86_64-apple-ios", x86_64_apple_ios),
("aarch64-apple-ios", aarch64_apple_ios),

View file

@ -0,0 +1,30 @@
// 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::fuchsia_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.push("-m64".to_string());
Ok(Target {
llvm_target: "x86_64-unknown-fuchsia".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "64".to_string(),
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(),
target_os: "fuchsia".to_string(),
target_env: "".to_string(),
target_vendor: "unknown".to_string(),
options: base,
})
}