@@ -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 =
@@ -1006,6 +1008,20 @@ mod parse {
10061008 true
10071009 }
10081010
1011+ /// Parses `-C link-self-contained`: it used to be a boolean without a static default, but now
1012+ /// also accepts some strings, in addition to the regular boolean values.
1013+ crate fn parse_link_self_contained ( slot : & mut LinkSelfContained , v : Option < & str > ) -> bool {
1014+ // Whenever `-C link-self-contained` is passed without a value, it's an opt-in
1015+ // just like `parse_opt_bool`.
1016+ let s = v. unwrap_or ( "y" ) ;
1017+
1018+ match LinkSelfContained :: from_str ( s) . ok ( ) {
1019+ Some ( value) => * slot = value,
1020+ None => return false ,
1021+ }
1022+ true
1023+ }
1024+
10091025 crate fn parse_stack_protector ( slot : & mut StackProtector , v : Option < & str > ) -> bool {
10101026 match v. and_then ( |s| StackProtector :: from_str ( s) . ok ( ) ) {
10111027 Some ( ssp) => * slot = ssp,
@@ -1092,7 +1108,7 @@ options! {
10921108 "extra arguments to append to the linker invocation (space separated)" ) ,
10931109 link_dead_code: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
10941110 "keep dead code at link time (useful for code coverage) (default: no)" ) ,
1095- link_self_contained: Option < bool > = ( None , parse_opt_bool , [ UNTRACKED ] ,
1111+ link_self_contained: LinkSelfContained = ( LinkSelfContained :: default ( ) , parse_link_self_contained , [ UNTRACKED ] ,
10961112 "control whether to link Rust provided C objects/libraries or rely
10971113 on C toolchain installed in the system" ) ,
10981114 linker: Option <PathBuf > = ( None , parse_opt_pathbuf, [ UNTRACKED ] ,
0 commit comments