@@ -222,6 +222,8 @@ pub struct Config {
222222 pub rust_debuginfo_level_tests : DebuginfoLevel ,
223223 pub rust_split_debuginfo : SplitDebuginfo ,
224224 pub rust_rpath : bool ,
225+ pub rust_strip : bool ,
226+ pub rust_stack_protector : StackProtector ,
225227 pub rustc_parallel : bool ,
226228 pub rustc_default_linker : Option < String > ,
227229 pub rust_optimize_tests : bool ,
@@ -394,6 +396,29 @@ impl SplitDebuginfo {
394396 }
395397}
396398
399+ /// Stack protector mode for compiling rustc itself
400+ #[ derive( Default , Clone , PartialEq , Debug ) ]
401+ pub enum StackProtector {
402+ #[ default]
403+ None ,
404+ Basic ,
405+ Strong ,
406+ All ,
407+ }
408+
409+ impl std:: str:: FromStr for StackProtector {
410+ type Err = String ;
411+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
412+ match s {
413+ "none" => Ok ( StackProtector :: None ) ,
414+ "basic" => Ok ( StackProtector :: Basic ) ,
415+ "strong" => Ok ( StackProtector :: Strong ) ,
416+ "all" => Ok ( StackProtector :: All ) ,
417+ _ => Err ( format ! ( "Invalid value for stack protector: {s}" ) ) ,
418+ }
419+ }
420+ }
421+
397422/// LTO mode used for compiling rustc itself.
398423#[ derive( Default , Clone , PartialEq , Debug ) ]
399424pub enum RustcLto {
@@ -1000,6 +1025,8 @@ define_config! {
10001025 description: Option <String > = "description" ,
10011026 musl_root: Option <String > = "musl-root" ,
10021027 rpath: Option <bool > = "rpath" ,
1028+ strip: Option <bool > = "strip" ,
1029+ stack_protector: Option <String > = "stack-protector" ,
10031030 verbose_tests: Option <bool > = "verbose-tests" ,
10041031 optimize_tests: Option <bool > = "optimize-tests" ,
10051032 codegen_tests: Option <bool > = "codegen-tests" ,
@@ -1067,6 +1094,7 @@ impl Config {
10671094 config. docs = true ;
10681095 config. docs_minification = true ;
10691096 config. rust_rpath = true ;
1097+ config. rust_strip = false ;
10701098 config. channel = "dev" . to_string ( ) ;
10711099 config. codegen_tests = true ;
10721100 config. rust_dist_src = true ;
@@ -1420,6 +1448,12 @@ impl Config {
14201448 set ( & mut config. rust_optimize_tests , rust. optimize_tests ) ;
14211449 set ( & mut config. codegen_tests , rust. codegen_tests ) ;
14221450 set ( & mut config. rust_rpath , rust. rpath ) ;
1451+ set ( & mut config. rust_strip , rust. strip ) ;
1452+ config. rust_stack_protector = rust
1453+ . stack_protector
1454+ . as_deref ( )
1455+ . map ( |value| StackProtector :: from_str ( value) . unwrap ( ) )
1456+ . unwrap_or_default ( ) ;
14231457 set ( & mut config. jemalloc , rust. jemalloc ) ;
14241458 set ( & mut config. test_compare_mode , rust. test_compare_mode ) ;
14251459 set ( & mut config. backtrace , rust. backtrace ) ;
0 commit comments