Auto merge of #34980 - cardoe:expose-target-options, r=alexcrichton
Convert built-in targets to JSON Convert the built-in targets to JSON to ensure that the JSON parser is always fully featured. This follows on #32988 and #32847. The PR includes a number of extra commits that are just intermediate changes necessary for bisectibility and the ability to prove correctness of the change.
This commit is contained in:
commit
1523a5480a
@ -8,11 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
use super::apple_ios_base::{opts, Arch};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let base = try!(opts(Arch::Arm64));
|
||||
Ok(Target {
|
||||
llvm_target: "arm64-apple-ios".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -25,7 +26,7 @@ pub fn target() -> Target {
|
||||
features: "+neon,+fp-armv8,+cyclone".to_string(),
|
||||
eliminate_frame_pointer: false,
|
||||
max_atomic_width: 128,
|
||||
.. opts(Arch::Arm64)
|
||||
.. base
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::android_base::opts();
|
||||
base.max_atomic_width = 128;
|
||||
// As documented in http://developer.android.com/ndk/guides/cpu-features.html
|
||||
// the neon (ASIMD) and FP must exist on all android aarch64 targets.
|
||||
base.features = "+neon,+fp-armv8".to_string();
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "aarch64-linux-android".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,12 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.max_atomic_width = 128;
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -23,5 +23,5 @@ pub fn target() -> Target {
|
||||
target_os: "linux".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ impl Arch {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_sdk_root(sdk_name: &str) -> String {
|
||||
pub fn get_sdk_root(sdk_name: &str) -> Result<String, String> {
|
||||
let res = Command::new("xcrun")
|
||||
.arg("--show-sdk-path")
|
||||
.arg("-sdk")
|
||||
@ -55,12 +55,12 @@ pub fn get_sdk_root(sdk_name: &str) -> String {
|
||||
});
|
||||
|
||||
match res {
|
||||
Ok(output) => output.trim().to_string(),
|
||||
Err(e) => panic!("failed to get {} SDK path: {}", sdk_name, e)
|
||||
Ok(output) => Ok(output.trim().to_string()),
|
||||
Err(e) => Err(format!("failed to get {} SDK path: {}", sdk_name, e))
|
||||
}
|
||||
}
|
||||
|
||||
fn pre_link_args(arch: Arch) -> Vec<String> {
|
||||
fn build_pre_link_args(arch: Arch) -> Result<Vec<String>, String> {
|
||||
let sdk_name = match arch {
|
||||
Armv7 | Armv7s | Arm64 => "iphoneos",
|
||||
I386 | X86_64 => "iphonesimulator"
|
||||
@ -68,8 +68,10 @@ fn pre_link_args(arch: Arch) -> Vec<String> {
|
||||
|
||||
let arch_name = arch.to_string();
|
||||
|
||||
vec!["-arch".to_string(), arch_name.to_string(),
|
||||
"-Wl,-syslibroot".to_string(), get_sdk_root(sdk_name)]
|
||||
let sdk_root = try!(get_sdk_root(sdk_name));
|
||||
|
||||
Ok(vec!["-arch".to_string(), arch_name.to_string(),
|
||||
"-Wl,-syslibroot".to_string(), sdk_root])
|
||||
}
|
||||
|
||||
fn target_cpu(arch: Arch) -> String {
|
||||
@ -82,13 +84,14 @@ fn target_cpu(arch: Arch) -> String {
|
||||
}.to_string()
|
||||
}
|
||||
|
||||
pub fn opts(arch: Arch) -> TargetOptions {
|
||||
TargetOptions {
|
||||
pub fn opts(arch: Arch) -> Result<TargetOptions, String> {
|
||||
let pre_link_args = try!(build_pre_link_args(arch));
|
||||
Ok(TargetOptions {
|
||||
cpu: target_cpu(arch),
|
||||
dynamic_linking: false,
|
||||
executables: true,
|
||||
pre_link_args: pre_link_args(arch),
|
||||
pre_link_args: pre_link_args,
|
||||
has_elf_tls: false,
|
||||
.. super::apple_base::opts()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::android_base::opts();
|
||||
base.features = "+v7,+vfp3,+d16".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "arm-linux-androideabi".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -25,5 +25,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,12 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.max_atomic_width = 64;
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -27,5 +27,5 @@ pub fn target() -> Target {
|
||||
features: "+v6".to_string(),
|
||||
.. base
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,12 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.max_atomic_width = 64;
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -27,5 +27,5 @@ pub fn target() -> Target {
|
||||
features: "+v6,+vfp2".to_string(),
|
||||
.. base
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,11 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
use super::apple_ios_base::{opts, Arch};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let base = try!(opts(Arch::Armv7));
|
||||
Ok(Target {
|
||||
llvm_target: "armv7-apple-ios".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -24,7 +25,7 @@ pub fn target() -> Target {
|
||||
options: TargetOptions {
|
||||
features: "+v7,+vfp3,+neon".to_string(),
|
||||
max_atomic_width: 64,
|
||||
.. opts(Arch::Armv7)
|
||||
.. base
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::android_base::opts();
|
||||
base.features = "+v7,+thumb2,+vfp3,+d16".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "armv7-none-linux-android".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -25,5 +25,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,11 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let base = super::linux_base::opts();
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "armv7-unknown-linux-gnueabihf".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -28,6 +28,6 @@ pub fn target() -> Target {
|
||||
max_atomic_width: 64,
|
||||
.. base
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
use super::apple_ios_base::{opts, Arch};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let base = try!(opts(Arch::Armv7s));
|
||||
Ok(Target {
|
||||
llvm_target: "armv7s-apple-ios".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -24,7 +25,7 @@ pub fn target() -> Target {
|
||||
options: TargetOptions {
|
||||
features: "+v7,+vfp4,+neon".to_string(),
|
||||
max_atomic_width: 64,
|
||||
.. opts(Arch::Armv7s)
|
||||
.. base
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
use super::{Target, TargetOptions};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> Result<Target, String> {
|
||||
let opts = TargetOptions {
|
||||
linker: "emcc".to_string(),
|
||||
ar: "emar".to_string(),
|
||||
@ -25,7 +25,7 @@ pub fn target() -> Target {
|
||||
max_atomic_width: 32,
|
||||
.. Default::default()
|
||||
};
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "asmjs-unknown-emscripten".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -35,5 +35,5 @@ pub fn target() -> Target {
|
||||
data_layout: "e-p:32:32-i64:64-v128:32:128-n32-S128".to_string(),
|
||||
arch: "asmjs".to_string(),
|
||||
options: opts,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,11 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
use super::apple_ios_base::{opts, Arch};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let base = try!(opts(Arch::I386));
|
||||
Ok(Target {
|
||||
llvm_target: "i386-apple-ios".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -23,7 +24,7 @@ pub fn target() -> Target {
|
||||
target_vendor: "apple".to_string(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: 64,
|
||||
.. opts(Arch::I386)
|
||||
.. base
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,11 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::TargetResult;
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut base = super::i686_pc_windows_msvc::target();
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = try!(super::i686_pc_windows_msvc::target());
|
||||
base.options.cpu = "pentium".to_string();
|
||||
base.llvm_target = "i586-pc-windows-msvc".to_string();
|
||||
return base
|
||||
Ok(base)
|
||||
}
|
||||
|
@ -8,11 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::TargetResult;
|
||||
|
||||
pub fn target() -> Target {
|
||||
let mut base = super::i686_unknown_linux_gnu::target();
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = try!(super::i686_unknown_linux_gnu::target());
|
||||
base.options.cpu = "pentium".to_string();
|
||||
base.llvm_target = "i586-unknown-linux-gnu".to_string();
|
||||
return base
|
||||
Ok(base)
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::apple_base::opts();
|
||||
base.cpu = "yonah".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m32".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "i686-apple-darwin".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "apple".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::android_base::opts();
|
||||
|
||||
base.max_atomic_width = 64;
|
||||
@ -19,7 +19,7 @@ pub fn target() -> Target {
|
||||
base.cpu = "pentiumpro".to_string();
|
||||
base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".to_string();
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "i686-linux-android".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -29,5 +29,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::windows_base::opts();
|
||||
base.cpu = "pentium4".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
@ -19,7 +19,7 @@ pub fn target() -> Target {
|
||||
// space available to x86 Windows binaries on x86_64.
|
||||
base.pre_link_args.push("-Wl,--large-address-aware".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "i686-pc-windows-gnu".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -29,5 +29,5 @@ pub fn target() -> Target {
|
||||
target_env: "gnu".to_string(),
|
||||
target_vendor: "pc".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::windows_msvc_base::opts();
|
||||
base.cpu = "pentium4".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
@ -24,7 +24,7 @@ pub fn target() -> Target {
|
||||
// https://msdn.microsoft.com/en-us/library/9a89h429.aspx
|
||||
base.pre_link_args.push("/SAFESEH".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "i686-pc-windows-msvc".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -34,5 +34,5 @@ pub fn target() -> Target {
|
||||
target_env: "msvc".to_string(),
|
||||
target_vendor: "pc".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::dragonfly_base::opts();
|
||||
base.cpu = "pentium4".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m32".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "i686-unknown-dragonfly".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::freebsd_base::opts();
|
||||
base.cpu = "pentium4".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m32".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "i686-unknown-freebsd".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.cpu = "pentium4".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m32".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "i686-unknown-linux-gnu".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "gnu".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,16 +8,16 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_musl_base::opts();
|
||||
base.cpu = "pentium4".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m32".to_string());
|
||||
base.pre_link_args.push("-Wl,-melf_i386".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "i686-unknown-linux-musl".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -27,5 +27,5 @@ pub fn target() -> Target {
|
||||
target_env: "musl".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use super::{Target, TargetOptions};
|
||||
use super::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let opts = TargetOptions {
|
||||
linker: "pnacl-clang".to_string(),
|
||||
ar: "pnacl-ar".to_string(),
|
||||
@ -28,7 +28,7 @@ pub fn target() -> Target {
|
||||
max_atomic_width: 32,
|
||||
.. Default::default()
|
||||
};
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "le32-unknown-nacl".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -38,5 +38,5 @@ pub fn target() -> Target {
|
||||
data_layout: "e-i64:64:64-p:32:32:32-v128:32:32".to_string(),
|
||||
arch: "le32".to_string(),
|
||||
options: opts,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,10 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
Ok(Target {
|
||||
llvm_target: "mips-unknown-linux-gnu".to_string(),
|
||||
target_endian: "big".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
max_atomic_width: 32,
|
||||
..super::linux_base::opts()
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,10 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
Ok(Target {
|
||||
llvm_target: "mips-unknown-linux-musl".to_string(),
|
||||
target_endian: "big".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
max_atomic_width: 32,
|
||||
..super::linux_base::opts()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,10 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
Ok(Target {
|
||||
llvm_target: "mipsel-unknown-linux-gnu".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -27,5 +27,5 @@ pub fn target() -> Target {
|
||||
max_atomic_width: 32,
|
||||
..super::linux_base::opts()
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,10 +8,10 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
Ok(Target {
|
||||
llvm_target: "mipsel-unknown-linux-musl".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
max_atomic_width: 32,
|
||||
..super::linux_base::opts()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -44,7 +44,8 @@
|
||||
//! the target's settings, though `target-feature` and `link-args` will *add*
|
||||
//! to the list specified by the target, rather than replace.
|
||||
|
||||
use serialize::json::Json;
|
||||
use serialize::json::{Json, ToJson};
|
||||
use std::collections::BTreeMap;
|
||||
use std::default::Default;
|
||||
use std::io::prelude::*;
|
||||
use syntax::abi::Abi;
|
||||
@ -63,26 +64,62 @@ mod solaris_base;
|
||||
mod windows_base;
|
||||
mod windows_msvc_base;
|
||||
|
||||
pub type TargetResult = Result<Target, String>;
|
||||
|
||||
macro_rules! supported_targets {
|
||||
( $(($triple:expr, $module:ident)),+ ) => (
|
||||
$(mod $module;)*
|
||||
|
||||
/// List of supported targets
|
||||
pub const TARGETS: &'static [&'static str] = &[$($triple),*];
|
||||
const TARGETS: &'static [&'static str] = &[$($triple),*];
|
||||
|
||||
fn load_specific(target: &str) -> Option<Target> {
|
||||
fn load_specific(target: &str) -> TargetResult {
|
||||
match target {
|
||||
$(
|
||||
$triple => {
|
||||
let mut t = $module::target();
|
||||
let mut t = try!($module::target());
|
||||
t.options.is_builtin = true;
|
||||
|
||||
// round-trip through the JSON parser to ensure at
|
||||
// run-time that the parser works correctly
|
||||
t = try!(Target::from_json(t.to_json()));
|
||||
debug!("Got builtin target: {:?}", t);
|
||||
Some(t)
|
||||
Ok(t)
|
||||
},
|
||||
)+
|
||||
_ => None
|
||||
_ => Err(format!("Unable to find target: {}", target))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_targets() -> Box<Iterator<Item=String>> {
|
||||
Box::new(TARGETS.iter().filter_map(|t| -> Option<String> {
|
||||
load_specific(t)
|
||||
.map(|t| t.llvm_target)
|
||||
.ok()
|
||||
}))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_json_encode_decode {
|
||||
use serialize::json::ToJson;
|
||||
use super::Target;
|
||||
$(use super::$module;)*
|
||||
|
||||
$(
|
||||
#[test]
|
||||
fn $module() {
|
||||
// Grab the TargetResult struct. If we successfully retrieved
|
||||
// a Target, then the test JSON encoding/decoding can run for this
|
||||
// Target on this testing platform (i.e., checking the iOS targets
|
||||
// only on a Mac test platform).
|
||||
let _ = $module::target().map(|original| {
|
||||
let as_json = original.to_json();
|
||||
let parsed = Target::from_json(as_json).unwrap();
|
||||
assert_eq!(original, parsed);
|
||||
});
|
||||
}
|
||||
)*
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@ -145,7 +182,7 @@ supported_targets! {
|
||||
/// Everything `rustc` knows about how to compile for a specific target.
|
||||
///
|
||||
/// Every field here must be specified, and has no default value.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
pub struct Target {
|
||||
/// Target triple to pass to LLVM.
|
||||
pub llvm_target: String,
|
||||
@ -172,7 +209,7 @@ pub struct Target {
|
||||
///
|
||||
/// This has an implementation of `Default`, see each field for what the default is. In general,
|
||||
/// these try to take "minimal defaults" that don't assume anything about the runtime they run in.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(PartialEq, Clone, Debug)]
|
||||
pub struct TargetOptions {
|
||||
/// Whether the target is built-in or loaded from a custom target specification.
|
||||
pub is_builtin: bool,
|
||||
@ -363,16 +400,21 @@ impl Target {
|
||||
}
|
||||
|
||||
/// Load a target descriptor from a JSON object.
|
||||
pub fn from_json(obj: Json) -> Target {
|
||||
// this is 1. ugly, 2. error prone.
|
||||
pub fn from_json(obj: Json) -> TargetResult {
|
||||
// While ugly, this code must remain this way to retain
|
||||
// compatibility with existing JSON fields and the internal
|
||||
// expected naming of the Target and TargetOptions structs.
|
||||
// To ensure compatibility is retained, the built-in targets
|
||||
// are round-tripped through this code to catch cases where
|
||||
// the JSON parser is not updated to match the structs.
|
||||
|
||||
let get_req_field = |name: &str| {
|
||||
match obj.find(name)
|
||||
.map(|s| s.as_string())
|
||||
.and_then(|os| os.map(|s| s.to_string())) {
|
||||
Some(val) => val,
|
||||
Some(val) => Ok(val),
|
||||
None => {
|
||||
panic!("Field {} in target specification is required", name)
|
||||
return Err(format!("Field {} in target specification is required", name))
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -384,12 +426,12 @@ impl Target {
|
||||
};
|
||||
|
||||
let mut base = Target {
|
||||
llvm_target: get_req_field("llvm-target"),
|
||||
target_endian: get_req_field("target-endian"),
|
||||
target_pointer_width: get_req_field("target-pointer-width"),
|
||||
data_layout: get_req_field("data-layout"),
|
||||
arch: get_req_field("arch"),
|
||||
target_os: get_req_field("os"),
|
||||
llvm_target: try!(get_req_field("llvm-target")),
|
||||
target_endian: try!(get_req_field("target-endian")),
|
||||
target_pointer_width: try!(get_req_field("target-pointer-width")),
|
||||
data_layout: try!(get_req_field("data-layout")),
|
||||
arch: try!(get_req_field("arch")),
|
||||
target_os: try!(get_req_field("os")),
|
||||
target_env: get_opt_field("env", ""),
|
||||
target_vendor: get_opt_field("vendor", "unknown"),
|
||||
options: Default::default(),
|
||||
@ -434,38 +476,50 @@ impl Target {
|
||||
} );
|
||||
}
|
||||
|
||||
key!(cpu);
|
||||
key!(ar);
|
||||
key!(is_builtin, bool);
|
||||
key!(linker);
|
||||
key!(ar);
|
||||
key!(pre_link_args, list);
|
||||
key!(pre_link_objects_exe, list);
|
||||
key!(pre_link_objects_dll, list);
|
||||
key!(late_link_args, list);
|
||||
key!(post_link_objects, list);
|
||||
key!(post_link_args, list);
|
||||
key!(cpu);
|
||||
key!(features);
|
||||
key!(dynamic_linking, bool);
|
||||
key!(executables, bool);
|
||||
key!(relocation_model);
|
||||
key!(code_model);
|
||||
key!(disable_redzone, bool);
|
||||
key!(eliminate_frame_pointer, bool);
|
||||
key!(function_sections, bool);
|
||||
key!(dll_prefix);
|
||||
key!(dll_suffix);
|
||||
key!(exe_suffix);
|
||||
key!(staticlib_prefix);
|
||||
key!(staticlib_suffix);
|
||||
key!(features);
|
||||
key!(dynamic_linking, bool);
|
||||
key!(executables, bool);
|
||||
key!(disable_redzone, bool);
|
||||
key!(eliminate_frame_pointer, bool);
|
||||
key!(function_sections, bool);
|
||||
key!(target_family, optional);
|
||||
key!(is_like_osx, bool);
|
||||
key!(is_like_solaris, bool);
|
||||
key!(is_like_windows, bool);
|
||||
key!(is_like_msvc, bool);
|
||||
key!(is_like_android, bool);
|
||||
key!(linker_is_gnu, bool);
|
||||
key!(has_rpath, bool);
|
||||
key!(no_compiler_rt, bool);
|
||||
key!(no_default_libraries, bool);
|
||||
key!(pre_link_args, list);
|
||||
key!(post_link_args, list);
|
||||
key!(position_independent_executables, bool);
|
||||
key!(archive_format);
|
||||
key!(allow_asm, bool);
|
||||
key!(custom_unwind_resume, bool);
|
||||
key!(lib_allocation_crate);
|
||||
key!(exe_allocation_crate);
|
||||
key!(has_elf_tls, bool);
|
||||
key!(obj_is_bitcode, bool);
|
||||
key!(max_atomic_width, u64);
|
||||
|
||||
base
|
||||
Ok(base)
|
||||
}
|
||||
|
||||
/// Search RUST_TARGET_PATH for a JSON file specifying the given target
|
||||
@ -488,10 +542,10 @@ impl Target {
|
||||
f.read_to_end(&mut contents).map_err(|e| e.to_string())?;
|
||||
let obj = json::from_reader(&mut &contents[..])
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok(Target::from_json(obj))
|
||||
Target::from_json(obj)
|
||||
}
|
||||
|
||||
if let Some(t) = load_specific(target) {
|
||||
if let Ok(t) = load_specific(target) {
|
||||
return Ok(t)
|
||||
}
|
||||
|
||||
@ -523,6 +577,94 @@ impl Target {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for Target {
|
||||
fn to_json(&self) -> Json {
|
||||
let mut d = BTreeMap::new();
|
||||
let default: TargetOptions = Default::default();
|
||||
|
||||
macro_rules! target_val {
|
||||
($attr:ident) => ( {
|
||||
let name = (stringify!($attr)).replace("_", "-");
|
||||
d.insert(name.to_string(), self.$attr.to_json());
|
||||
} );
|
||||
($attr:ident, $key_name:expr) => ( {
|
||||
let name = $key_name;
|
||||
d.insert(name.to_string(), self.$attr.to_json());
|
||||
} );
|
||||
}
|
||||
|
||||
macro_rules! target_option_val {
|
||||
($attr:ident) => ( {
|
||||
let name = (stringify!($attr)).replace("_", "-");
|
||||
if default.$attr != self.options.$attr {
|
||||
d.insert(name.to_string(), self.options.$attr.to_json());
|
||||
}
|
||||
} );
|
||||
($attr:ident, $key_name:expr) => ( {
|
||||
let name = $key_name;
|
||||
if default.$attr != self.options.$attr {
|
||||
d.insert(name.to_string(), self.options.$attr.to_json());
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
target_val!(llvm_target);
|
||||
target_val!(target_endian);
|
||||
target_val!(target_pointer_width);
|
||||
target_val!(arch);
|
||||
target_val!(target_os, "os");
|
||||
target_val!(target_env, "env");
|
||||
target_val!(target_vendor, "vendor");
|
||||
target_val!(arch);
|
||||
target_val!(data_layout);
|
||||
|
||||
target_option_val!(is_builtin);
|
||||
target_option_val!(linker);
|
||||
target_option_val!(ar);
|
||||
target_option_val!(pre_link_args);
|
||||
target_option_val!(pre_link_objects_exe);
|
||||
target_option_val!(pre_link_objects_dll);
|
||||
target_option_val!(late_link_args);
|
||||
target_option_val!(post_link_objects);
|
||||
target_option_val!(post_link_args);
|
||||
target_option_val!(cpu);
|
||||
target_option_val!(features);
|
||||
target_option_val!(dynamic_linking);
|
||||
target_option_val!(executables);
|
||||
target_option_val!(relocation_model);
|
||||
target_option_val!(code_model);
|
||||
target_option_val!(disable_redzone);
|
||||
target_option_val!(eliminate_frame_pointer);
|
||||
target_option_val!(function_sections);
|
||||
target_option_val!(dll_prefix);
|
||||
target_option_val!(dll_suffix);
|
||||
target_option_val!(exe_suffix);
|
||||
target_option_val!(staticlib_prefix);
|
||||
target_option_val!(staticlib_suffix);
|
||||
target_option_val!(target_family);
|
||||
target_option_val!(is_like_osx);
|
||||
target_option_val!(is_like_solaris);
|
||||
target_option_val!(is_like_windows);
|
||||
target_option_val!(is_like_msvc);
|
||||
target_option_val!(is_like_android);
|
||||
target_option_val!(linker_is_gnu);
|
||||
target_option_val!(has_rpath);
|
||||
target_option_val!(no_compiler_rt);
|
||||
target_option_val!(no_default_libraries);
|
||||
target_option_val!(position_independent_executables);
|
||||
target_option_val!(archive_format);
|
||||
target_option_val!(allow_asm);
|
||||
target_option_val!(custom_unwind_resume);
|
||||
target_option_val!(lib_allocation_crate);
|
||||
target_option_val!(exe_allocation_crate);
|
||||
target_option_val!(has_elf_tls);
|
||||
target_option_val!(obj_is_bitcode);
|
||||
target_option_val!(max_atomic_width);
|
||||
|
||||
Json::Object(d)
|
||||
}
|
||||
}
|
||||
|
||||
fn maybe_jemalloc() -> String {
|
||||
if cfg!(feature = "jemalloc") {
|
||||
"alloc_jemalloc".to_string()
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.cpu = "ppc64".to_string();
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
base.max_atomic_width = 64;
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "powerpc64-unknown-linux-gnu".to_string(),
|
||||
target_endian: "big".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "gnu".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.cpu = "ppc64le".to_string();
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
base.max_atomic_width = 64;
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "powerpc64le-unknown-linux-gnu".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "gnu".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.pre_link_args.push("-m32".to_string());
|
||||
base.max_atomic_width = 32;
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "powerpc-unknown-linux-gnu".to_string(),
|
||||
target_endian: "big".to_string(),
|
||||
target_pointer_width: "32".to_string(),
|
||||
@ -25,5 +25,5 @@ pub fn target() -> Target {
|
||||
target_env: "gnu".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,16 +8,16 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::apple_base::opts();
|
||||
base.cpu = "core2".to_string();
|
||||
base.max_atomic_width = 128; // core2 support cmpxchg16b
|
||||
base.eliminate_frame_pointer = false;
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-apple-darwin".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -27,5 +27,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "apple".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,11 +8,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::{Target, TargetOptions};
|
||||
use target::{Target, TargetOptions, TargetResult};
|
||||
use super::apple_ios_base::{opts, Arch};
|
||||
|
||||
pub fn target() -> Target {
|
||||
Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let base = try!(opts(Arch::X86_64));
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-apple-ios".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -23,7 +24,7 @@ pub fn target() -> Target {
|
||||
target_vendor: "apple".to_string(),
|
||||
options: TargetOptions {
|
||||
max_atomic_width: 64,
|
||||
.. opts(Arch::X86_64)
|
||||
.. base
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::windows_base::opts();
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
base.max_atomic_width = 64;
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-pc-windows-gnu".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "gnu".to_string(),
|
||||
target_vendor: "pc".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::windows_msvc_base::opts();
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-pc-windows-msvc".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -25,5 +25,5 @@ pub fn target() -> Target {
|
||||
target_env: "msvc".to_string(),
|
||||
target_vendor: "pc".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::netbsd_base::opts();
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
base.linker = "x86_64-rumprun-netbsd-gcc".to_string();
|
||||
@ -24,7 +24,7 @@ pub fn target() -> Target {
|
||||
base.no_default_libraries = false;
|
||||
base.exe_allocation_crate = "alloc_system".to_string();
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-rumprun-netbsd".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -34,5 +34,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "rumprun".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::solaris_base::opts();
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-pc-solaris".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "sun".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::bitrig_base::opts();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-unknown-bitrig".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -25,5 +25,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::dragonfly_base::opts();
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-unknown-dragonfly".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::freebsd_base::opts();
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-unknown-freebsd".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_base::opts();
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-unknown-linux-gnu".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "gnu".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::linux_musl_base::opts();
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-unknown-linux-musl".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "musl".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,14 +8,14 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::netbsd_base::opts();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-unknown-netbsd".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -25,5 +25,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use target::Target;
|
||||
use target::{Target, TargetResult};
|
||||
|
||||
pub fn target() -> Target {
|
||||
pub fn target() -> TargetResult {
|
||||
let mut base = super::openbsd_base::opts();
|
||||
base.cpu = "x86-64".to_string();
|
||||
base.max_atomic_width = 64;
|
||||
base.pre_link_args.push("-m64".to_string());
|
||||
|
||||
Target {
|
||||
Ok(Target {
|
||||
llvm_target: "x86_64-unknown-openbsd".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
@ -26,5 +26,5 @@ pub fn target() -> Target {
|
||||
target_env: "".to_string(),
|
||||
target_vendor: "unknown".to_string(),
|
||||
options: base,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ impl RustcDefaultCalls {
|
||||
for req in &sess.opts.prints {
|
||||
match *req {
|
||||
PrintRequest::TargetList => {
|
||||
let mut targets = rustc_back::target::TARGETS.to_vec();
|
||||
let mut targets = rustc_back::target::get_targets().collect::<Vec<String>>();
|
||||
targets.sort();
|
||||
println!("{}", targets.join("\n"));
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user