@@ -414,6 +414,8 @@ mod desc {
414
414
pub const parse_split_dwarf_kind: & str =
415
415
"one of supported split dwarf modes (`split` or `single`)" ;
416
416
pub const parse_gcc_ld: & str = "one of: no value, `lld`" ;
417
+ pub const parse_link_self_contained: & str =
418
+ "one of: `y`, `yes`, `on`, `n`, `no`, `off`, `auto`, `crt`, `linker`, `all`" ;
417
419
pub const parse_stack_protector: & str =
418
420
"one of (`none` (default), `basic`, `strong`, or `all`)" ;
419
421
pub const parse_branch_protection: & str =
@@ -1027,6 +1029,20 @@ mod parse {
1027
1029
true
1028
1030
}
1029
1031
1032
+ /// Parses `-C link-self-contained`: it used to be a boolean without a static default, but now
1033
+ /// also accepts some strings, in addition to the regular boolean values.
1034
+ pub ( crate ) fn parse_link_self_contained ( slot : & mut LinkSelfContained , v : Option < & str > ) -> bool {
1035
+ // Whenever `-C link-self-contained` is passed without a value, it's an opt-in
1036
+ // just like `parse_opt_bool`.
1037
+ let s = v. unwrap_or ( "y" ) ;
1038
+
1039
+ match LinkSelfContained :: from_str ( s) . ok ( ) {
1040
+ Some ( value) => * slot = value,
1041
+ None => return false ,
1042
+ }
1043
+ true
1044
+ }
1045
+
1030
1046
pub ( crate ) fn parse_stack_protector ( slot : & mut StackProtector , v : Option < & str > ) -> bool {
1031
1047
match v. and_then ( |s| StackProtector :: from_str ( s) . ok ( ) ) {
1032
1048
Some ( ssp) => * slot = ssp,
@@ -1116,7 +1132,7 @@ options! {
1116
1132
"extra arguments to append to the linker invocation (space separated)" ) ,
1117
1133
link_dead_code: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1118
1134
"keep dead code at link time (useful for code coverage) (default: no)" ) ,
1119
- link_self_contained: Option < bool > = ( None , parse_opt_bool , [ UNTRACKED ] ,
1135
+ link_self_contained: LinkSelfContained = ( LinkSelfContained :: default ( ) , parse_link_self_contained , [ UNTRACKED ] ,
1120
1136
"control whether to link Rust provided C objects/libraries or rely
1121
1137
on C toolchain installed in the system" ) ,
1122
1138
linker: Option <PathBuf > = ( None , parse_opt_pathbuf, [ UNTRACKED ] ,
0 commit comments