rustc_target: Move target_os from Target to TargetOptions

This commit is contained in:
Vadim Petrochenkov 2020-10-08 20:54:45 +03:00
parent 91533cf10e
commit 74ffb9b4a2
173 changed files with 52 additions and 169 deletions

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target {
let mut base = super::apple_base::opts();
let mut base = super::apple_base::opts("macos");
base.cpu = "apple-a12".to_string();
base.max_atomic_width = Some(128);
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);
@ -19,7 +19,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: arch.to_string(),
target_os: "macos".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -2,13 +2,12 @@ use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target {
let base = opts(Arch::Arm64);
let base = opts("ios", Arch::Arm64);
Target {
llvm_target: "arm64-apple-ios".to_string(),
pointer_width: 64,
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "ios".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -2,13 +2,12 @@ use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target {
let base = opts(Arch::Arm64);
let base = opts("tvos", Arch::Arm64);
Target {
llvm_target: "arm64-apple-tvos".to_string(),
pointer_width: 64,
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "tvos".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "fuchsia".to_string(),
target_env: String::new(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),

View File

@ -14,7 +14,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "android".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Msvc,

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "cloudabi".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "freebsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "hermit".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),

View File

@ -10,7 +10,6 @@ pub fn target() -> Target {
target_env: "gnu".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "linux".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {

View File

@ -10,7 +10,6 @@ pub fn target() -> Target {
target_env: "musl".to_string(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "linux".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions {

View File

@ -10,7 +10,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "netbsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -24,7 +24,6 @@ pub fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-none".to_string(),
pointer_width: 64,
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),

View File

@ -24,7 +24,6 @@ pub fn target() -> Target {
Target {
llvm_target: "aarch64-unknown-none".to_string(),
pointer_width: 64,
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),

View File

@ -10,7 +10,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "openbsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "redox".to_string(),
target_env: "relibc".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -10,7 +10,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Msvc,

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
arch: "aarch64".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -2,6 +2,7 @@ use crate::spec::{LinkerFlavor, TargetOptions};
pub fn opts() -> TargetOptions {
let mut base = super::linux_base::opts();
base.target_os = "android".to_string();
// Many of the symbols defined in compiler-rt are also defined in libgcc.
// Android's linker doesn't like that by default.
base.pre_link_args

View File

@ -2,7 +2,7 @@ use std::env;
use crate::spec::{LinkArgs, TargetOptions};
pub fn opts() -> TargetOptions {
pub fn opts(os: &str) -> TargetOptions {
// ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6
// either the linker will complain if it is used or the binary will end up
// segfaulting at runtime when run on 10.6. Rust by default supports macOS
@ -17,6 +17,7 @@ pub fn opts() -> TargetOptions {
let version = macos_deployment_target();
TargetOptions {
target_os: os.to_string(),
// macOS has -dead_strip, which doesn't rely on function_sections
function_sections: false,
dynamic_linking: true,

View File

@ -31,7 +31,7 @@ fn link_env_remove(arch: Arch) -> Vec<String> {
}
}
pub fn opts(arch: Arch) -> TargetOptions {
pub fn opts(os: &str, arch: Arch) -> TargetOptions {
TargetOptions {
cpu: target_cpu(arch),
dynamic_linking: false,
@ -39,6 +39,6 @@ pub fn opts(arch: Arch) -> TargetOptions {
link_env_remove: link_env_remove(arch),
has_elf_tls: false,
eliminate_frame_pointer: false,
..super::apple_base::opts()
..super::apple_base::opts(os)
}
}

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "android".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -8,7 +8,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -8,7 +8,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -15,7 +15,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -15,7 +15,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "none".to_string(),
target_env: "".to_string(),
target_vendor: "".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),

View File

@ -7,7 +7,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -7,7 +7,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -10,7 +10,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -7,7 +7,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "freebsd".to_string(),
target_env: "gnueabihf".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -8,7 +8,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "netbsd".to_string(),
target_env: "eabihf".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -2,13 +2,12 @@ use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target {
let base = opts(Arch::Armv7);
let base = opts("ios", Arch::Armv7);
Target {
llvm_target: "armv7-apple-ios".to_string(),
pointer_width: 32,
data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
arch: "arm".to_string(),
target_os: "ios".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -19,7 +19,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "android".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -13,7 +13,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "cloudabi".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -7,7 +7,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "freebsd".to_string(),
target_env: "gnueabihf".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -10,7 +10,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -10,7 +10,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -15,7 +15,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -12,7 +12,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -7,7 +7,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "netbsd".to_string(),
target_env: "eabihf".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -7,7 +7,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -35,7 +35,6 @@ pub fn target() -> Target {
Target {
llvm_target: "armv7a-none-eabi".to_string(),
pointer_width: 32,
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),

View File

@ -23,7 +23,6 @@ pub fn target() -> Target {
Target {
llvm_target: "armv7a-none-eabihf".to_string(),
pointer_width: 32,
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "none".to_string(),
target_env: "".to_string(),
target_vendor: "".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),

View File

@ -9,7 +9,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
arch: "arm".to_string(),
target_os: "none".to_string(),
target_env: "".to_string(),
target_vendor: "".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),

View File

@ -2,13 +2,12 @@ use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target {
let base = opts(Arch::Armv7s);
let base = opts("ios", Arch::Armv7s);
Target {
llvm_target: "armv7s-apple-ios".to_string(),
pointer_width: 32,
data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
arch: "arm".to_string(),
target_os: "ios".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -10,11 +10,11 @@ pub fn target(target_cpu: String) -> Target {
llvm_target: "avr-unknown-unknown".to_string(),
pointer_width: 16,
linker_flavor: LinkerFlavor::Gcc,
target_os: "unknown".to_string(),
target_env: "".to_string(),
target_vendor: "unknown".to_string(),
options: TargetOptions {
target_c_int_width: "16".to_string(),
target_os: "unknown".to_string(),
cpu: target_cpu.clone(),
exe_suffix: ".elf".to_string(),

View File

@ -12,6 +12,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "cloudabi".to_string(),
executables: true,
target_family: None,
linker_is_gnu: true,

View File

@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "dragonfly".to_string(),
dynamic_linking: true,
executables: true,
target_family: Some("unix".to_string()),

View File

@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "freebsd".to_string(),
dynamic_linking: true,
executables: true,
target_family: Some("unix".to_string()),

View File

@ -20,6 +20,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "fuchsia".to_string(),
linker: Some("rust-lld".to_owned()),
lld_flavor: LldFlavor::Ld,
dynamic_linking: true,

View File

@ -2,6 +2,7 @@ use crate::spec::{RelroLevel, TargetOptions};
pub fn opts() -> TargetOptions {
TargetOptions {
target_os: "haiku".to_string(),
dynamic_linking: true,
executables: true,
has_rpath: false,

View File

@ -9,6 +9,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "hermit".to_string(),
linker: Some("rust-lld".to_owned()),
executables: true,
has_elf_tls: true,

View File

@ -9,6 +9,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "hermit".to_string(),
disable_redzone: true,
linker: Some("rust-lld".to_owned()),
executables: true,

View File

@ -28,7 +28,6 @@ pub fn target() -> Target {
)
.to_string(),
arch: "hexagon".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -2,7 +2,7 @@ use super::apple_sdk_base::{opts, Arch};
use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target {
let base = opts(Arch::I386);
let base = opts("ios", Arch::I386);
Target {
llvm_target: "i386-apple-ios".to_string(),
pointer_width: 32,
@ -10,7 +10,6 @@ pub fn target() -> Target {
f64:32:64-f80:128-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "ios".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -1,7 +1,7 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions};
pub fn target() -> Target {
let mut base = super::apple_base::opts();
let mut base = super::apple_base::opts("macos");
base.cpu = "yonah".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m32".to_string()]);
@ -22,7 +22,6 @@ pub fn target() -> Target {
f64:32:64-f80:128-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "macos".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -20,7 +20,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "android".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -23,7 +23,6 @@ pub fn target() -> Target {
i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(),
arch: "x86".to_string(),
target_os: "windows".to_string(),
target_env: "gnu".to_string(),
target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -27,7 +27,6 @@ pub fn target() -> Target {
i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(),
arch: "x86".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "pc".to_string(),
linker_flavor: LinkerFlavor::Msvc,

View File

@ -15,7 +15,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "cloudabi".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -16,7 +16,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "freebsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -14,7 +14,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "haiku".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -14,7 +14,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -29,7 +29,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -14,7 +14,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "netbsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -15,7 +15,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "openbsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -82,7 +82,6 @@ pub fn target() -> Target {
data_layout: "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(),
target_os: "uefi".to_string(),
target_env: "".to_string(),
target_vendor: "unknown".to_string(),
arch: "x86".to_string(),

View File

@ -22,7 +22,6 @@ pub fn target() -> Target {
i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(),
arch: "x86".to_string(),
target_os: "windows".to_string(),
target_env: "gnu".to_string(),
target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -13,7 +13,6 @@ pub fn target() -> Target {
i64:64-f80:32-n8:16:32-a:0:32-S32"
.to_string(),
arch: "x86".to_string(),
target_os: "windows".to_string(),
target_env: "msvc".to_string(),
target_vendor: "uwp".to_string(),
linker_flavor: LinkerFlavor::Msvc,

View File

@ -14,7 +14,6 @@ pub fn target() -> Target {
f64:32:64-f80:32-n8:16:32-S128"
.to_string(),
arch: "x86".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "illumos".to_string(),
dynamic_linking: true,
executables: true,
has_rpath: true,

View File

@ -17,6 +17,7 @@ pub fn opts() -> TargetOptions {
args.insert(LinkerFlavor::Gcc, vec![]);
TargetOptions {
target_os: "l4re".to_string(),
executables: true,
has_elf_tls: false,
panic_strategy: PanicStrategy::Abort,

View File

@ -19,6 +19,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "linux".to_string(),
dynamic_linking: true,
executables: true,
target_family: Some("unix".to_string()),

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "uclibc".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -13,12 +13,12 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "psp".to_string(),
target_env: "".to_string(),
target_vendor: "sony".to_string(),
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
options: TargetOptions {
target_os: "psp".to_string(),
cpu: "mips2".to_string(),
executables: true,
linker: Some("rust-lld".to_owned()),

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "uclibc".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 32,
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128".to_string(),
arch: "mips64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -667,8 +667,6 @@ pub struct Target {
pub llvm_target: String,
/// Number of bits in a pointer. Influences the `target_pointer_width` `cfg` variable.
pub pointer_width: u32,
/// OS name to use for conditional compilation.
pub target_os: String,
/// Environment name to use for conditional compilation.
pub target_env: String,
/// Vendor name to use for conditional compilation.
@ -708,6 +706,8 @@ pub struct TargetOptions {
pub target_endian: String,
/// Width of c_int type. Defaults to "32".
pub target_c_int_width: String,
/// OS name to use for conditional compilation. Defaults to "none".
pub target_os: String,
/// Linker to invoke
pub linker: Option<String>,
@ -989,6 +989,7 @@ impl Default for TargetOptions {
is_builtin: false,
target_endian: "little".to_string(),
target_c_int_width: "32".to_string(),
target_os: "none".to_string(),
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.to_string()),
lld_flavor: LldFlavor::Ld,
pre_link_args: LinkArgs::new(),
@ -1164,7 +1165,6 @@ impl Target {
.map_err(|_| "target-pointer-width must be an integer".to_string())?,
data_layout: get_req_field("data-layout")?,
arch: get_req_field("arch")?,
target_os: get_req_field("os")?,
target_env: get_opt_field("env", ""),
target_vendor: get_opt_field("vendor", "unknown"),
linker_flavor: LinkerFlavor::from_str(&*get_req_field("linker-flavor")?)
@ -1179,6 +1179,12 @@ impl Target {
base.options.$key_name = s.to_string();
}
} );
($key_name:ident = $json_name:expr) => ( {
let name = $json_name;
if let Some(s) = obj.find(&name).and_then(Json::as_string) {
base.options.$key_name = s.to_string();
}
} );
($key_name:ident, bool) => ( {
let name = (stringify!($key_name)).replace("_", "-");
if let Some(s) = obj.find(&name).and_then(Json::as_boolean) {
@ -1407,6 +1413,7 @@ impl Target {
key!(is_builtin, bool);
key!(target_endian);
key!(target_c_int_width);
key!(target_os = "os");
key!(linker, optional);
key!(lld_flavor, LldFlavor)?;
key!(pre_link_objects, link_objects);
@ -1636,7 +1643,6 @@ impl ToJson for Target {
target_val!(llvm_target);
d.insert("target-pointer-width".to_string(), self.pointer_width.to_string().to_json());
target_val!(arch);
target_val!(target_os, "os");
target_val!(target_env, "env");
target_val!(target_vendor, "vendor");
target_val!(data_layout);
@ -1644,6 +1650,7 @@ impl ToJson for Target {
target_option_val!(target_endian);
target_option_val!(target_c_int_width);
target_option_val!(target_os, "os");
target_option_val!(is_builtin);
target_option_val!(linker);
target_option_val!(lld_flavor);

View File

@ -6,7 +6,6 @@ pub fn target() -> Target {
pointer_width: 16,
data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(),
arch: "msp430".to_string(),
target_os: "none".to_string(),
target_env: String::new(),
target_vendor: String::new(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -14,6 +14,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "netbsd".to_string(),
dynamic_linking: true,
executables: true,
target_family: Some("unix".to_string()),

View File

@ -7,7 +7,6 @@ pub fn target() -> Target {
data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".to_string(),
llvm_target: "nvptx64-nvidia-cuda".to_string(),
target_os: "cuda".to_string(),
target_vendor: "nvidia".to_string(),
target_env: String::new(),
@ -16,6 +15,7 @@ pub fn target() -> Target {
pointer_width: 64,
options: TargetOptions {
target_os: "cuda".to_string(),
// The linker can be installed from `crates.io`.
linker: Some("rust-ptx-linker".to_string()),

View File

@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
);
TargetOptions {
target_os: "openbsd".to_string(),
dynamic_linking: true,
executables: true,
target_family: Some("unix".to_string()),

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i64:64-n32:64".to_string(),
arch: "powerpc64".to_string(),
target_os: "freebsd".to_string(),
target_env: String::new(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -15,7 +15,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i64:64-n32:64".to_string(),
arch: "powerpc64".to_string(),
target_os: "linux".to_string(),
target_env: "gnu".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i64:64-n32:64".to_string(),
arch: "powerpc64".to_string(),
target_os: "linux".to_string(),
target_env: "musl".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Gcc,

View File

@ -11,7 +11,6 @@ pub fn target() -> Target {
pointer_width: 64,
data_layout: "E-m:e-i64:64-n32:64".to_string(),
arch: "powerpc64".to_string(),
target_os: "vxworks".to_string(),
target_env: "gnu".to_string(),
target_vendor: "wrs".to_string(),
linker_flavor: LinkerFlavor::Gcc,

Some files were not shown because too many files have changed in this diff Show More