3 use super::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions}
;
5 pub fn target() -> Result
<Target
, String
> {
6 const PRE_LINK_ARGS
: &[&str] = &[
16 "--error-unresolved-symbols",
17 "--no-undefined-version",
20 // The following symbols are needed by libunwind, which is linked after
21 // libstd. Make sure they're included in the link.
23 "-u","__rust_c_alloc",
24 "-u","__rust_c_dealloc",
25 "-u","__rust_print_err",
26 "-u","__rust_rwlock_rdlock",
27 "-u","__rust_rwlock_unlock",
28 "-u","__rust_rwlock_wrlock"
31 const EXPORT_SYMBOLS
: &[&str] = &[
45 let opts
= TargetOptions
{
46 dynamic_linking
: false,
49 linker
: Some("rust-lld".to_owned()),
50 max_atomic_width
: Some(64),
51 panic_strategy
: PanicStrategy
::Unwind
,
53 features
: "+rdrnd,+rdseed".into(),
54 position_independent_executables
: true,
55 pre_link_args
: iter
::once((
56 LinkerFlavor
::Lld(LldFlavor
::Ld
),
57 PRE_LINK_ARGS
.iter().cloned().map(String
::from
).collect(),
60 post_link_objects
: vec
!["libunwind.a".into()],
61 override_export_symbols
: Some(EXPORT_SYMBOLS
.iter().cloned().map(String
::from
).collect()),
62 relax_elf_relocations
: true,
66 llvm_target
: "x86_64-elf".into(),
67 target_endian
: "little".into(),
68 target_pointer_width
: "64".into(),
69 target_c_int_width
: "32".into(),
70 target_os
: "unknown".into(),
71 target_env
: "sgx".into(),
72 target_vendor
: "fortanix".into(),
73 data_layout
: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".into(),
74 arch
: "x86_64".into(),
75 linker_flavor
: LinkerFlavor
::Lld(LldFlavor
::Ld
),