3 use super::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions};
5 pub fn target() -> Result<Target, String> {
6 const PRE_LINK_ARGS: &[&str] = &[
20 "--error-unresolved-symbols",
21 "--no-undefined-version",
24 // The following symbols are needed by libunwind, which is linked after
25 // libstd. Make sure they're included in the link.
35 "__rust_rwlock_rdlock",
37 "__rust_rwlock_unlock",
39 "__rust_rwlock_wrlock",
42 const EXPORT_SYMBOLS: &[&str] = &[
56 let opts = TargetOptions {
57 dynamic_linking: false,
60 linker: Some("rust-lld".to_owned()),
61 max_atomic_width: Some(64),
62 panic_strategy: PanicStrategy::Unwind,
64 features: "+rdrnd,+rdseed".into(),
65 position_independent_executables: true,
66 pre_link_args: iter::once((
67 LinkerFlavor::Lld(LldFlavor::Ld),
68 PRE_LINK_ARGS.iter().cloned().map(String::from).collect(),
71 post_link_objects: vec!["libunwind.a".into()],
72 override_export_symbols: Some(EXPORT_SYMBOLS.iter().cloned().map(String::from).collect()),
73 relax_elf_relocations: true,
77 llvm_target: "x86_64-elf".into(),
78 target_endian: "little".into(),
79 target_pointer_width: "64".into(),
80 target_c_int_width: "32".into(),
81 target_os: "unknown".into(),
82 target_env: "sgx".into(),
83 target_vendor: "fortanix".into(),
84 data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
86 arch: "x86_64".into(),
87 linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),