@@ -420,20 +420,22 @@ pub struct TargetOptions {
420
420
/// Linker to invoke
421
421
pub linker: Option<String>,
422
422
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
426
426
/// Objects to link before all others, always found within the
427
427
/// 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
429
430
pub pre_link_objects_dll: Vec<String>, // ... when linking a dylib
430
431
/// Linker arguments that are unconditionally passed after any
431
432
/// user-defined but before post_link_objects. Standard platform
432
433
/// libraries that should be always be linked to, usually go here.
433
434
pub late_link_args: LinkArgs,
434
435
/// Objects to link after all others, always found within the
435
436
/// 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
437
439
/// Linker arguments that are unconditionally passed *after* any
438
440
/// user-defined libraries.
439
441
pub post_link_args: LinkArgs,
@@ -633,6 +635,7 @@ impl Default for TargetOptions {
633
635
is_builtin: false,
634
636
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.to_string()),
635
637
pre_link_args: LinkArgs::new(),
638
+ pre_link_args_crt: LinkArgs::new(),
636
639
post_link_args: LinkArgs::new(),
637
640
asm_args: Vec::new(),
638
641
cpu: "generic".to_string(),
@@ -666,8 +669,10 @@ impl Default for TargetOptions {
666
669
position_independent_executables: false,
667
670
relro_level: RelroLevel::None,
668
671
pre_link_objects_exe: Vec::new(),
672
+ pre_link_objects_exe_crt: Vec::new(),
669
673
pre_link_objects_dll: Vec::new(),
670
674
post_link_objects: Vec::new(),
675
+ post_link_objects_crt: Vec::new(),
671
676
late_link_args: LinkArgs::new(),
672
677
link_env: Vec::new(),
673
678
archive_format: "gnu".to_string(),
@@ -886,10 +891,13 @@ impl Target {
886
891
key!(is_builtin, bool);
887
892
key!(linker, optional);
888
893
key!(pre_link_args, link_args);
894
+ key!(pre_link_args_crt, link_args);
889
895
key!(pre_link_objects_exe, list);
896
+ key!(pre_link_objects_exe_crt, list);
890
897
key!(pre_link_objects_dll, list);
891
898
key!(late_link_args, link_args);
892
899
key!(post_link_objects, list);
900
+ key!(post_link_objects_crt, list);
893
901
key!(post_link_args, link_args);
894
902
key!(link_env, env);
895
903
key!(asm_args, list);
@@ -1091,10 +1099,13 @@ impl ToJson for Target {
1091
1099
target_option_val!(is_builtin);
1092
1100
target_option_val!(linker);
1093
1101
target_option_val!(link_args - pre_link_args);
1102
+ target_option_val!(link_args - pre_link_args_crt);
1094
1103
target_option_val!(pre_link_objects_exe);
1104
+ target_option_val!(pre_link_objects_exe_crt);
1095
1105
target_option_val!(pre_link_objects_dll);
1096
1106
target_option_val!(link_args - late_link_args);
1097
1107
target_option_val!(post_link_objects);
1108
+ target_option_val!(post_link_objects_crt);
1098
1109
target_option_val!(link_args - post_link_args);
1099
1110
target_option_val!(env - link_env);
1100
1111
target_option_val!(asm_args);
0 commit comments