@@ -426,20 +426,22 @@ pub struct TargetOptions {
426426 /// Linker to invoke
427427 pub linker : Option < String > ,
428428
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
432432 /// Objects to link before all others, always found within the
433433 /// 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
435436 pub pre_link_objects_dll : Vec < String > , // ... when linking a dylib
436437 /// Linker arguments that are unconditionally passed after any
437438 /// user-defined but before post_link_objects. Standard platform
438439 /// libraries that should be always be linked to, usually go here.
439440 pub late_link_args : LinkArgs ,
440441 /// Objects to link after all others, always found within the
441442 /// 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
443445 /// Linker arguments that are unconditionally passed *after* any
444446 /// user-defined libraries.
445447 pub post_link_args : LinkArgs ,
@@ -639,6 +641,7 @@ impl Default for TargetOptions {
639641 is_builtin : false ,
640642 linker : option_env ! ( "CFG_DEFAULT_LINKER" ) . map ( |s| s. to_string ( ) ) ,
641643 pre_link_args : LinkArgs :: new ( ) ,
644+ pre_link_args_crt : LinkArgs :: new ( ) ,
642645 post_link_args : LinkArgs :: new ( ) ,
643646 asm_args : Vec :: new ( ) ,
644647 cpu : "generic" . to_string ( ) ,
@@ -672,8 +675,10 @@ impl Default for TargetOptions {
672675 position_independent_executables : false ,
673676 relro_level : RelroLevel :: None ,
674677 pre_link_objects_exe : Vec :: new ( ) ,
678+ pre_link_objects_exe_crt : Vec :: new ( ) ,
675679 pre_link_objects_dll : Vec :: new ( ) ,
676680 post_link_objects : Vec :: new ( ) ,
681+ post_link_objects_crt : Vec :: new ( ) ,
677682 late_link_args : LinkArgs :: new ( ) ,
678683 link_env : Vec :: new ( ) ,
679684 archive_format : "gnu" . to_string ( ) ,
@@ -892,10 +897,13 @@ impl Target {
892897 key ! ( is_builtin, bool ) ;
893898 key ! ( linker, optional) ;
894899 key ! ( pre_link_args, link_args) ;
900+ key ! ( pre_link_args_crt, link_args) ;
895901 key ! ( pre_link_objects_exe, list) ;
902+ key ! ( pre_link_objects_exe_crt, list) ;
896903 key ! ( pre_link_objects_dll, list) ;
897904 key ! ( late_link_args, link_args) ;
898905 key ! ( post_link_objects, list) ;
906+ key ! ( post_link_objects_crt, list) ;
899907 key ! ( post_link_args, link_args) ;
900908 key ! ( link_env, env) ;
901909 key ! ( asm_args, list) ;
@@ -1097,10 +1105,13 @@ impl ToJson for Target {
10971105 target_option_val ! ( is_builtin) ;
10981106 target_option_val ! ( linker) ;
10991107 target_option_val ! ( link_args - pre_link_args) ;
1108+ target_option_val ! ( link_args - pre_link_args_crt) ;
11001109 target_option_val ! ( pre_link_objects_exe) ;
1110+ target_option_val ! ( pre_link_objects_exe_crt) ;
11011111 target_option_val ! ( pre_link_objects_dll) ;
11021112 target_option_val ! ( link_args - late_link_args) ;
11031113 target_option_val ! ( post_link_objects) ;
1114+ target_option_val ! ( post_link_objects_crt) ;
11041115 target_option_val ! ( link_args - post_link_args) ;
11051116 target_option_val ! ( env - link_env) ;
11061117 target_option_val ! ( asm_args) ;
0 commit comments