1
1
use std:: { borrow:: Cow , env} ;
2
2
3
+ use crate :: spec:: link_args:: LazyLinkArgsState ;
3
4
use crate :: spec:: { add_link_args, add_link_args_iter, MaybeLazy } ;
4
5
use crate :: spec:: { cvs, Cc , DebuginfoKind , FramePointer , LinkArgs , LinkerFlavor , Lld } ;
5
6
use crate :: spec:: { SplitDebuginfo , StackProbeType , StaticCow , Target , TargetOptions } ;
@@ -94,7 +95,10 @@ impl TargetAbi {
94
95
}
95
96
}
96
97
97
- pub fn pre_link_args ( os : & ' static str , arch : Arch , abi : TargetAbi ) -> LinkArgs {
98
+ pub ( crate ) type ApplePreLinkArgs =
99
+ ( /*os:*/ & ' static str , /*arch:*/ Arch , /*abi:*/ TargetAbi ) ;
100
+
101
+ pub ( crate ) fn pre_link_args ( ( os, arch, abi) : ApplePreLinkArgs ) -> LinkArgs {
98
102
let platform_name: StaticCow < str > = match abi {
99
103
TargetAbi :: Normal => os. into ( ) ,
100
104
TargetAbi :: Simulator => format ! ( "{os}-simulator" ) . into ( ) ,
@@ -114,7 +118,9 @@ pub fn pre_link_args(os: &'static str, arch: Arch, abi: TargetAbi) -> LinkArgs {
114
118
} ;
115
119
let sdk_version = min_version. clone ( ) ;
116
120
117
- let mut args = TargetOptions :: link_args_base (
121
+ let mut args = LinkArgs :: new ( ) ;
122
+ add_link_args (
123
+ & mut args,
118
124
LinkerFlavor :: Darwin ( Cc :: No , Lld :: No ) ,
119
125
& [ "-arch" , arch. target_name ( ) , "-platform_version" ] ,
120
126
) ;
@@ -140,12 +146,7 @@ pub fn pre_link_args(os: &'static str, arch: Arch, abi: TargetAbi) -> LinkArgs {
140
146
args
141
147
}
142
148
143
- pub fn opts (
144
- os : & ' static str ,
145
- arch : Arch ,
146
- abi : TargetAbi ,
147
- pre_link_args : MaybeLazy < LinkArgs , ( LinkerFlavor , & ' static [ & ' static str ] ) > ,
148
- ) -> TargetOptions {
149
+ pub fn opts ( os : & ' static str , arch : Arch , abi : TargetAbi ) -> TargetOptions {
149
150
TargetOptions {
150
151
abi : abi. target_abi ( ) . into ( ) ,
151
152
os : os. into ( ) ,
@@ -156,7 +157,7 @@ pub fn opts(
156
157
// macOS has -dead_strip, which doesn't rely on function_sections
157
158
function_sections : false ,
158
159
dynamic_linking : true ,
159
- pre_link_args,
160
+ pre_link_args : MaybeLazy :: lazied ( LazyLinkArgsState :: Apple ( ( os , arch , abi ) ) ) ,
160
161
families : cvs ! [ "unix" ] ,
161
162
is_like_osx : true ,
162
163
// LLVM notes that macOS 10.11+ and iOS 9+ default
0 commit comments