@@ -279,20 +279,22 @@ pub struct TargetOptions {
279
279
/// Linker to invoke. Defaults to "cc".
280
280
pub linker : String ,
281
281
282
- /// Linker arguments that are unconditionally passed *before* any
283
- /// user-defined libraries.
284
- pub pre_link_args : LinkArgs ,
282
+ /// Linker arguments that are passed *before* any user-defined libraries.
283
+ pub pre_link_args : LinkArgs , // ... unconditionally
284
+ pub pre_link_args_crt : LinkArgs , // ... when linking with a bundled crt
285
285
/// Objects to link before all others, always found within the
286
286
/// sysroot folder.
287
- pub pre_link_objects_exe : Vec < String > , // ... when linking an executable
287
+ pub pre_link_objects_exe : Vec < String > , // ... when linking an executable, unconditionally
288
+ pub pre_link_objects_exe_crt : Vec < String > , // ... when linking an executable with a bundled crt
288
289
pub pre_link_objects_dll : Vec < String > , // ... when linking a dylib
289
290
/// Linker arguments that are unconditionally passed after any
290
291
/// user-defined but before post_link_objects. Standard platform
291
292
/// libraries that should be always be linked to, usually go here.
292
293
pub late_link_args : LinkArgs ,
293
294
/// Objects to link after all others, always found within the
294
295
/// sysroot folder.
295
- pub post_link_objects : Vec < String > ,
296
+ pub post_link_objects : Vec < String > , // ... unconditionally
297
+ pub post_link_objects_crt : Vec < String > , // ... when linking with a bundled crt
296
298
/// Linker arguments that are unconditionally passed *after* any
297
299
/// user-defined libraries.
298
300
pub post_link_args : LinkArgs ,
@@ -482,6 +484,7 @@ impl Default for TargetOptions {
482
484
is_builtin : false ,
483
485
linker : option_env ! ( "CFG_DEFAULT_LINKER" ) . unwrap_or ( "cc" ) . to_string ( ) ,
484
486
pre_link_args : LinkArgs :: new ( ) ,
487
+ pre_link_args_crt : LinkArgs :: new ( ) ,
485
488
post_link_args : LinkArgs :: new ( ) ,
486
489
asm_args : Vec :: new ( ) ,
487
490
cpu : "generic" . to_string ( ) ,
@@ -515,8 +518,10 @@ impl Default for TargetOptions {
515
518
position_independent_executables : false ,
516
519
relro_level : RelroLevel :: Off ,
517
520
pre_link_objects_exe : Vec :: new ( ) ,
521
+ pre_link_objects_exe_crt : Vec :: new ( ) ,
518
522
pre_link_objects_dll : Vec :: new ( ) ,
519
523
post_link_objects : Vec :: new ( ) ,
524
+ post_link_objects_crt : Vec :: new ( ) ,
520
525
late_link_args : LinkArgs :: new ( ) ,
521
526
link_env : Vec :: new ( ) ,
522
527
archive_format : "gnu" . to_string ( ) ,
@@ -732,10 +737,13 @@ impl Target {
732
737
key ! ( is_builtin, bool ) ;
733
738
key ! ( linker) ;
734
739
key ! ( pre_link_args, link_args) ;
740
+ key ! ( pre_link_args_crt, link_args) ;
735
741
key ! ( pre_link_objects_exe, list) ;
742
+ key ! ( pre_link_objects_exe_crt, list) ;
736
743
key ! ( pre_link_objects_dll, list) ;
737
744
key ! ( late_link_args, link_args) ;
738
745
key ! ( post_link_objects, list) ;
746
+ key ! ( post_link_objects_crt, list) ;
739
747
key ! ( post_link_args, link_args) ;
740
748
key ! ( link_env, env) ;
741
749
key ! ( asm_args, list) ;
@@ -930,10 +938,13 @@ impl ToJson for Target {
930
938
target_option_val ! ( is_builtin) ;
931
939
target_option_val ! ( linker) ;
932
940
target_option_val ! ( link_args - pre_link_args) ;
941
+ target_option_val ! ( link_args - pre_link_args_crt) ;
933
942
target_option_val ! ( pre_link_objects_exe) ;
943
+ target_option_val ! ( pre_link_objects_exe_crt) ;
934
944
target_option_val ! ( pre_link_objects_dll) ;
935
945
target_option_val ! ( link_args - late_link_args) ;
936
946
target_option_val ! ( post_link_objects) ;
947
+ target_option_val ! ( post_link_objects_crt) ;
937
948
target_option_val ! ( link_args - post_link_args) ;
938
949
target_option_val ! ( env - link_env) ;
939
950
target_option_val ! ( asm_args) ;
0 commit comments