@@ -368,6 +368,7 @@ pub enum PrintRequest {
368368 TargetFeatures ,
369369 RelocationModels ,
370370 CodeModels ,
371+ TlsModels ,
371372 TargetSpec ,
372373 NativeStaticLibs ,
373374}
@@ -1104,6 +1105,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
11041105 "enable ThinLTO when possible" ) ,
11051106 inline_in_all_cgus: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
11061107 "control whether #[inline] functions are in all cgus" ) ,
1108+ tls_model: Option <String > = ( None , parse_opt_string, [ TRACKED ] ,
1109+ "choose the TLS model to use (rustc --print tls-models for details)" ) ,
11071110}
11081111
11091112pub fn default_lib_output ( ) -> CrateType {
@@ -1330,7 +1333,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
13301333 print on stdout",
13311334 "[crate-name|file-names|sysroot|cfg|target-list|\
13321335 target-cpus|target-features|relocation-models|\
1333- code-models|target-spec-json|native-static-libs]") ,
1336+ code-models|tls-models| target-spec-json|native-static-libs]") ,
13341337 opt:: flagmulti_s( "g" , "" , "Equivalent to -C debuginfo=2" ) ,
13351338 opt:: flagmulti_s( "O" , "" , "Equivalent to -C opt-level=2" ) ,
13361339 opt:: opt_s( "o" , "" , "Write output to <filename>" , "FILENAME" ) ,
@@ -1473,7 +1476,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
14731476 } )
14741477 } ) ;
14751478
1476- let debugging_opts = build_debugging_options ( matches, error_format) ;
1479+ let mut debugging_opts = build_debugging_options ( matches, error_format) ;
14771480
14781481 if !debugging_opts. unstable_options && error_format == ErrorOutputType :: Json ( true ) {
14791482 early_error ( ErrorOutputType :: Json ( false ) ,
@@ -1579,6 +1582,10 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
15791582 prints. push ( PrintRequest :: CodeModels ) ;
15801583 cg. code_model = None ;
15811584 }
1585+ if debugging_opts. tls_model . as_ref ( ) . map_or ( false , |s| s == "help" ) {
1586+ prints. push ( PrintRequest :: TlsModels ) ;
1587+ debugging_opts. tls_model = None ;
1588+ }
15821589
15831590 let cg = cg;
15841591
@@ -1678,6 +1685,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
16781685 "target-features" => PrintRequest :: TargetFeatures ,
16791686 "relocation-models" => PrintRequest :: RelocationModels ,
16801687 "code-models" => PrintRequest :: CodeModels ,
1688+ "tls-models" => PrintRequest :: TlsModels ,
16811689 "native-static-libs" => PrintRequest :: NativeStaticLibs ,
16821690 "target-spec-json" => {
16831691 if nightly_options:: is_unstable_enabled ( matches) {
@@ -2520,6 +2528,10 @@ mod tests {
25202528 opts. cg . code_model = Some ( String :: from ( "code model" ) ) ;
25212529 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
25222530
2531+ opts = reference. clone ( ) ;
2532+ opts. debugging_opts . tls_model = Some ( String :: from ( "tls model" ) ) ;
2533+ assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
2534+
25232535 opts = reference. clone ( ) ;
25242536 opts. cg . metadata = vec ! [ String :: from( "A" ) , String :: from( "B" ) ] ;
25252537 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
0 commit comments