@@ -420,20 +420,22 @@ pub struct TargetOptions {
420420 /// Linker to invoke
421421 pub linker : Option < String > ,
422422
423- /// Linker arguments that are unconditionally passed *before* any
424- /// user-defined libraries.
425- pub pre_link_args : LinkArgs ,
423+ /// Linker arguments that are passed *before* any user-defined libraries.
424+ pub pre_link_args : LinkArgs , // ... unconditionally
425+ pub pre_link_args_crt : LinkArgs , // ... when linking with a bundled crt
426426 /// Objects to link before all others, always found within the
427427 /// sysroot folder.
428- pub pre_link_objects_exe : Vec < String > , // ... when linking an executable
428+ pub pre_link_objects_exe : Vec < String > , // ... when linking an executable, unconditionally
429+ pub pre_link_objects_exe_crt : Vec < String > , // ... when linking an executable with a bundled crt
429430 pub pre_link_objects_dll : Vec < String > , // ... when linking a dylib
430431 /// Linker arguments that are unconditionally passed after any
431432 /// user-defined but before post_link_objects. Standard platform
432433 /// libraries that should be always be linked to, usually go here.
433434 pub late_link_args : LinkArgs ,
434435 /// Objects to link after all others, always found within the
435436 /// sysroot folder.
436- pub post_link_objects : Vec < String > ,
437+ pub post_link_objects : Vec < String > , // ... unconditionally
438+ pub post_link_objects_crt : Vec < String > , // ... when linking with a bundled crt
437439 /// Linker arguments that are unconditionally passed *after* any
438440 /// user-defined libraries.
439441 pub post_link_args : LinkArgs ,
@@ -633,6 +635,7 @@ impl Default for TargetOptions {
633635 is_builtin : false ,
634636 linker : option_env ! ( "CFG_DEFAULT_LINKER" ) . map ( |s| s. to_string ( ) ) ,
635637 pre_link_args : LinkArgs :: new ( ) ,
638+ pre_link_args_crt : LinkArgs :: new ( ) ,
636639 post_link_args : LinkArgs :: new ( ) ,
637640 asm_args : Vec :: new ( ) ,
638641 cpu : "generic" . to_string ( ) ,
@@ -666,8 +669,10 @@ impl Default for TargetOptions {
666669 position_independent_executables : false ,
667670 relro_level : RelroLevel :: None ,
668671 pre_link_objects_exe : Vec :: new ( ) ,
672+ pre_link_objects_exe_crt : Vec :: new ( ) ,
669673 pre_link_objects_dll : Vec :: new ( ) ,
670674 post_link_objects : Vec :: new ( ) ,
675+ post_link_objects_crt : Vec :: new ( ) ,
671676 late_link_args : LinkArgs :: new ( ) ,
672677 link_env : Vec :: new ( ) ,
673678 archive_format : "gnu" . to_string ( ) ,
@@ -886,10 +891,13 @@ impl Target {
886891 key ! ( is_builtin, bool ) ;
887892 key ! ( linker, optional) ;
888893 key ! ( pre_link_args, link_args) ;
894+ key ! ( pre_link_args_crt, link_args) ;
889895 key ! ( pre_link_objects_exe, list) ;
896+ key ! ( pre_link_objects_exe_crt, list) ;
890897 key ! ( pre_link_objects_dll, list) ;
891898 key ! ( late_link_args, link_args) ;
892899 key ! ( post_link_objects, list) ;
900+ key ! ( post_link_objects_crt, list) ;
893901 key ! ( post_link_args, link_args) ;
894902 key ! ( link_env, env) ;
895903 key ! ( asm_args, list) ;
@@ -1091,10 +1099,13 @@ impl ToJson for Target {
10911099 target_option_val ! ( is_builtin) ;
10921100 target_option_val ! ( linker) ;
10931101 target_option_val ! ( link_args - pre_link_args) ;
1102+ target_option_val ! ( link_args - pre_link_args_crt) ;
10941103 target_option_val ! ( pre_link_objects_exe) ;
1104+ target_option_val ! ( pre_link_objects_exe_crt) ;
10951105 target_option_val ! ( pre_link_objects_dll) ;
10961106 target_option_val ! ( link_args - late_link_args) ;
10971107 target_option_val ! ( post_link_objects) ;
1108+ target_option_val ! ( post_link_objects_crt) ;
10981109 target_option_val ! ( link_args - post_link_args) ;
10991110 target_option_val ! ( env - link_env) ;
11001111 target_option_val ! ( asm_args) ;
0 commit comments