1
1
use crate :: spec:: {
2
- FramePointer , SanitizerSet , StackProbeType , Target , TargetMetadata , TargetOptions , base,
2
+ Cc , FramePointer , LinkerFlavor , Lld , SanitizerSet , StackProbeType , Target , TargetMetadata ,
3
+ TargetOptions , base,
3
4
} ;
4
5
5
6
pub ( crate ) fn target ( ) -> Target {
7
+ let mut base = TargetOptions {
8
+ features : "+v8a,+outline-atomics" . into ( ) ,
9
+ // the AAPCS64 expects use of non-leaf frame pointers per
10
+ // https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
11
+ // and we tend to encounter interesting bugs in AArch64 unwinding code if we do not
12
+ frame_pointer : FramePointer :: NonLeaf ,
13
+ mcount : "\u{1} _mcount" . into ( ) ,
14
+ max_atomic_width : Some ( 128 ) ,
15
+ stack_probes : StackProbeType :: Inline ,
16
+ supported_sanitizers : SanitizerSet :: ADDRESS
17
+ | SanitizerSet :: CFI
18
+ | SanitizerSet :: KCFI
19
+ | SanitizerSet :: LEAK
20
+ | SanitizerSet :: MEMORY
21
+ | SanitizerSet :: MEMTAG
22
+ | SanitizerSet :: THREAD
23
+ | SanitizerSet :: HWADDRESS ,
24
+ supports_xray : true ,
25
+ ..base:: linux_gnu:: opts ( )
26
+ } ;
27
+
28
+ // When we're asked to use the `rust-lld` linker by default, set the appropriate lld-using
29
+ // linker flavor, and self-contained linker component.
30
+ if option_env ! ( "CFG_USE_SELF_CONTAINED_LINKER" ) . is_some ( ) {
31
+ base. linker_flavor = LinkerFlavor :: Gnu ( Cc :: Yes , Lld :: Yes ) ;
32
+ base. link_self_contained = crate :: spec:: LinkSelfContainedDefault :: with_linker ( ) ;
33
+ }
34
+
6
35
Target {
7
36
llvm_target : "aarch64-unknown-linux-gnu" . into ( ) ,
8
37
metadata : TargetMetadata {
@@ -14,25 +43,6 @@ pub(crate) fn target() -> Target {
14
43
pointer_width : 64 ,
15
44
data_layout : "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32" . into ( ) ,
16
45
arch : "aarch64" . into ( ) ,
17
- options : TargetOptions {
18
- features : "+v8a,+outline-atomics" . into ( ) ,
19
- // the AAPCS64 expects use of non-leaf frame pointers per
20
- // https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
21
- // and we tend to encounter interesting bugs in AArch64 unwinding code if we do not
22
- frame_pointer : FramePointer :: NonLeaf ,
23
- mcount : "\u{1} _mcount" . into ( ) ,
24
- max_atomic_width : Some ( 128 ) ,
25
- stack_probes : StackProbeType :: Inline ,
26
- supported_sanitizers : SanitizerSet :: ADDRESS
27
- | SanitizerSet :: CFI
28
- | SanitizerSet :: KCFI
29
- | SanitizerSet :: LEAK
30
- | SanitizerSet :: MEMORY
31
- | SanitizerSet :: MEMTAG
32
- | SanitizerSet :: THREAD
33
- | SanitizerSet :: HWADDRESS ,
34
- supports_xray : true ,
35
- ..base:: linux_gnu:: opts ( )
36
- } ,
46
+ options : base,
37
47
}
38
48
}
0 commit comments