@@ -426,20 +426,22 @@ pub struct TargetOptions {
426
426
/// Linker to invoke
427
427
pub linker : Option < String > ,
428
428
429
- /// Linker arguments that are unconditionally passed *before* any
430
- /// user-defined libraries.
431
- pub pre_link_args : LinkArgs ,
429
+ /// Linker arguments that are passed *before* any user-defined libraries.
430
+ pub pre_link_args : LinkArgs , // ... unconditionally
431
+ pub pre_link_args_crt : LinkArgs , // ... when linking with a bundled crt
432
432
/// Objects to link before all others, always found within the
433
433
/// sysroot folder.
434
- pub pre_link_objects_exe : Vec < String > , // ... when linking an executable
434
+ pub pre_link_objects_exe : Vec < String > , // ... when linking an executable, unconditionally
435
+ pub pre_link_objects_exe_crt : Vec < String > , // ... when linking an executable with a bundled crt
435
436
pub pre_link_objects_dll : Vec < String > , // ... when linking a dylib
436
437
/// Linker arguments that are unconditionally passed after any
437
438
/// user-defined but before post_link_objects. Standard platform
438
439
/// libraries that should be always be linked to, usually go here.
439
440
pub late_link_args : LinkArgs ,
440
441
/// Objects to link after all others, always found within the
441
442
/// sysroot folder.
442
- pub post_link_objects : Vec < String > ,
443
+ pub post_link_objects : Vec < String > , // ... unconditionally
444
+ pub post_link_objects_crt : Vec < String > , // ... when linking with a bundled crt
443
445
/// Linker arguments that are unconditionally passed *after* any
444
446
/// user-defined libraries.
445
447
pub post_link_args : LinkArgs ,
@@ -639,6 +641,7 @@ impl Default for TargetOptions {
639
641
is_builtin : false ,
640
642
linker : option_env ! ( "CFG_DEFAULT_LINKER" ) . map ( |s| s. to_string ( ) ) ,
641
643
pre_link_args : LinkArgs :: new ( ) ,
644
+ pre_link_args_crt : LinkArgs :: new ( ) ,
642
645
post_link_args : LinkArgs :: new ( ) ,
643
646
asm_args : Vec :: new ( ) ,
644
647
cpu : "generic" . to_string ( ) ,
@@ -672,8 +675,10 @@ impl Default for TargetOptions {
672
675
position_independent_executables : false ,
673
676
relro_level : RelroLevel :: None ,
674
677
pre_link_objects_exe : Vec :: new ( ) ,
678
+ pre_link_objects_exe_crt : Vec :: new ( ) ,
675
679
pre_link_objects_dll : Vec :: new ( ) ,
676
680
post_link_objects : Vec :: new ( ) ,
681
+ post_link_objects_crt : Vec :: new ( ) ,
677
682
late_link_args : LinkArgs :: new ( ) ,
678
683
link_env : Vec :: new ( ) ,
679
684
archive_format : "gnu" . to_string ( ) ,
@@ -892,10 +897,13 @@ impl Target {
892
897
key ! ( is_builtin, bool ) ;
893
898
key ! ( linker, optional) ;
894
899
key ! ( pre_link_args, link_args) ;
900
+ key ! ( pre_link_args_crt, link_args) ;
895
901
key ! ( pre_link_objects_exe, list) ;
902
+ key ! ( pre_link_objects_exe_crt, list) ;
896
903
key ! ( pre_link_objects_dll, list) ;
897
904
key ! ( late_link_args, link_args) ;
898
905
key ! ( post_link_objects, list) ;
906
+ key ! ( post_link_objects_crt, list) ;
899
907
key ! ( post_link_args, link_args) ;
900
908
key ! ( link_env, env) ;
901
909
key ! ( asm_args, list) ;
@@ -1097,10 +1105,13 @@ impl ToJson for Target {
1097
1105
target_option_val ! ( is_builtin) ;
1098
1106
target_option_val ! ( linker) ;
1099
1107
target_option_val ! ( link_args - pre_link_args) ;
1108
+ target_option_val ! ( link_args - pre_link_args_crt) ;
1100
1109
target_option_val ! ( pre_link_objects_exe) ;
1110
+ target_option_val ! ( pre_link_objects_exe_crt) ;
1101
1111
target_option_val ! ( pre_link_objects_dll) ;
1102
1112
target_option_val ! ( link_args - late_link_args) ;
1103
1113
target_option_val ! ( post_link_objects) ;
1114
+ target_option_val ! ( post_link_objects_crt) ;
1104
1115
target_option_val ! ( link_args - post_link_args) ;
1105
1116
target_option_val ! ( env - link_env) ;
1106
1117
target_option_val ! ( asm_args) ;
0 commit comments