@@ -368,6 +368,7 @@ pub enum PrintRequest {
368
368
TargetFeatures ,
369
369
RelocationModels ,
370
370
CodeModels ,
371
+ TlsModels ,
371
372
TargetSpec ,
372
373
NativeStaticLibs ,
373
374
}
@@ -1104,6 +1105,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1104
1105
"enable ThinLTO when possible" ) ,
1105
1106
inline_in_all_cgus: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
1106
1107
"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)" ) ,
1107
1110
}
1108
1111
1109
1112
pub fn default_lib_output ( ) -> CrateType {
@@ -1330,7 +1333,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
1330
1333
print on stdout",
1331
1334
"[crate-name|file-names|sysroot|cfg|target-list|\
1332
1335
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]") ,
1334
1337
opt:: flagmulti_s( "g" , "" , "Equivalent to -C debuginfo=2" ) ,
1335
1338
opt:: flagmulti_s( "O" , "" , "Equivalent to -C opt-level=2" ) ,
1336
1339
opt:: opt_s( "o" , "" , "Write output to <filename>" , "FILENAME" ) ,
@@ -1473,7 +1476,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
1473
1476
} )
1474
1477
} ) ;
1475
1478
1476
- let debugging_opts = build_debugging_options ( matches, error_format) ;
1479
+ let mut debugging_opts = build_debugging_options ( matches, error_format) ;
1477
1480
1478
1481
if !debugging_opts. unstable_options && error_format == ErrorOutputType :: Json ( true ) {
1479
1482
early_error ( ErrorOutputType :: Json ( false ) ,
@@ -1579,6 +1582,10 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
1579
1582
prints. push ( PrintRequest :: CodeModels ) ;
1580
1583
cg. code_model = None ;
1581
1584
}
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
+ }
1582
1589
1583
1590
let cg = cg;
1584
1591
@@ -1678,6 +1685,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
1678
1685
"target-features" => PrintRequest :: TargetFeatures ,
1679
1686
"relocation-models" => PrintRequest :: RelocationModels ,
1680
1687
"code-models" => PrintRequest :: CodeModels ,
1688
+ "tls-models" => PrintRequest :: TlsModels ,
1681
1689
"native-static-libs" => PrintRequest :: NativeStaticLibs ,
1682
1690
"target-spec-json" => {
1683
1691
if nightly_options:: is_unstable_enabled ( matches) {
@@ -2520,6 +2528,10 @@ mod tests {
2520
2528
opts. cg . code_model = Some ( String :: from ( "code model" ) ) ;
2521
2529
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
2522
2530
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
+
2523
2535
opts = reference. clone ( ) ;
2524
2536
opts. cg . metadata = vec ! [ String :: from( "A" ) , String :: from( "B" ) ] ;
2525
2537
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
0 commit comments