@@ -414,6 +414,8 @@ mod desc {
414414 pub const parse_split_dwarf_kind: & str =
415415 "one of supported split dwarf modes (`split` or `single`)" ;
416416 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`" ;
417419 pub const parse_stack_protector: & str =
418420 "one of (`none` (default), `basic`, `strong`, or `all`)" ;
419421 pub const parse_branch_protection: & str =
@@ -1027,6 +1029,20 @@ mod parse {
10271029 true
10281030 }
10291031
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+
10301046 pub ( crate ) fn parse_stack_protector ( slot : & mut StackProtector , v : Option < & str > ) -> bool {
10311047 match v. and_then ( |s| StackProtector :: from_str ( s) . ok ( ) ) {
10321048 Some ( ssp) => * slot = ssp,
@@ -1116,7 +1132,7 @@ options! {
11161132 "extra arguments to append to the linker invocation (space separated)" ) ,
11171133 link_dead_code: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
11181134 "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 ] ,
11201136 "control whether to link Rust provided C objects/libraries or rely
11211137 on C toolchain installed in the system" ) ,
11221138 linker: Option <PathBuf > = ( None , parse_opt_pathbuf, [ UNTRACKED ] ,
0 commit comments