@@ -6,7 +6,8 @@ use crate::search_paths::SearchPath;
6
6
use crate :: utils:: NativeLibraryKind ;
7
7
8
8
use rustc_target:: spec:: TargetTriple ;
9
- use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy , RelocModel , RelroLevel } ;
9
+ use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy } ;
10
+ use rustc_target:: spec:: { RelocModel , RelroLevel , TlsModel } ;
10
11
11
12
use rustc_feature:: UnstableFeatures ;
12
13
use rustc_span:: edition:: Edition ;
@@ -267,6 +268,8 @@ macro_rules! options {
267
268
pub const parse_src_file_hash: & str = "either `md5` or `sha1`" ;
268
269
pub const parse_relocation_model: & str =
269
270
"one of supported relocation models (`rustc --print relocation-models`)" ;
271
+ pub const parse_tls_model: & str =
272
+ "one of supported TLS models (`rustc --print tls-models`)" ;
270
273
}
271
274
272
275
#[ allow( dead_code) ]
@@ -606,6 +609,14 @@ macro_rules! options {
606
609
true
607
610
}
608
611
612
+ fn parse_tls_model( slot: & mut Option <TlsModel >, v: Option <& str >) -> bool {
613
+ match v. and_then( |s| TlsModel :: from_str( s) . ok( ) ) {
614
+ Some ( tls_model) => * slot = Some ( tls_model) ,
615
+ _ => return false ,
616
+ }
617
+ true
618
+ }
619
+
609
620
fn parse_symbol_mangling_version(
610
621
slot: & mut SymbolManglingVersion ,
611
622
v: Option <& str >,
@@ -977,7 +988,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
977
988
"measure time of each LLVM pass (default: no)" ) ,
978
989
time_passes: bool = ( false , parse_bool, [ UNTRACKED ] ,
979
990
"measure time of each rustc pass (default: no)" ) ,
980
- tls_model: Option <String > = ( None , parse_opt_string , [ TRACKED ] ,
991
+ tls_model: Option <TlsModel > = ( None , parse_tls_model , [ TRACKED ] ,
981
992
"choose the TLS model to use (`rustc --print tls-models` for details)" ) ,
982
993
trace_macros: bool = ( false , parse_bool, [ UNTRACKED ] ,
983
994
"for every macro invocation, print its name and arguments (default: no)" ) ,
0 commit comments