@@ -368,6 +368,7 @@ pub enum PrintRequest {
368368 TargetFeatures ,
369369 RelocationModels ,
370370 CodeModels ,
371+ TlsModels ,
371372 TargetSpec ,
372373 NativeStaticLibs ,
373374}
@@ -910,6 +911,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
910911 "choose the relocation model to use (rustc --print relocation-models for details)" ) ,
911912 code_model: Option <String > = ( None , parse_opt_string, [ TRACKED ] ,
912913 "choose the code model to use (rustc --print code-models for details)" ) ,
914+ tls_model: Option <String > = ( None , parse_opt_string, [ TRACKED ] ,
915+ "choose the TLS model to use (rustc --print tls-models for details)" ) ,
913916 metadata: Vec <String > = ( Vec :: new( ) , parse_list, [ TRACKED ] ,
914917 "metadata to mangle symbol names with" ) ,
915918 extra_filename: String = ( "" . to_string( ) , parse_string, [ UNTRACKED ] ,
@@ -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" ) ,
@@ -1573,6 +1576,10 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
15731576 prints. push ( PrintRequest :: CodeModels ) ;
15741577 cg. code_model = None ;
15751578 }
1579+ if cg. tls_model . as_ref ( ) . map_or ( false , |s| s == "help" ) {
1580+ prints. push ( PrintRequest :: TlsModels ) ;
1581+ cg. tls_model = None ;
1582+ }
15761583
15771584 let cg = cg;
15781585
@@ -1672,6 +1679,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
16721679 "target-features" => PrintRequest :: TargetFeatures ,
16731680 "relocation-models" => PrintRequest :: RelocationModels ,
16741681 "code-models" => PrintRequest :: CodeModels ,
1682+ "tls-models" => PrintRequest :: TlsModels ,
16751683 "native-static-libs" => PrintRequest :: NativeStaticLibs ,
16761684 "target-spec-json" => {
16771685 if nightly_options:: is_unstable_enabled ( matches) {
@@ -2514,6 +2522,10 @@ mod tests {
25142522 opts. cg . code_model = Some ( String :: from ( "code model" ) ) ;
25152523 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
25162524
2525+ opts = reference. clone ( ) ;
2526+ opts. cg . tls_model = Some ( String :: from ( "tls model" ) ) ;
2527+ assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
2528+
25172529 opts = reference. clone ( ) ;
25182530 opts. cg . metadata = vec ! [ String :: from( "A" ) , String :: from( "B" ) ] ;
25192531 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
0 commit comments