@@ -6,7 +6,8 @@ use crate::search_paths::SearchPath;
66use crate :: utils:: NativeLibraryKind ;
77
88use 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 } ;
1011
1112use rustc_feature:: UnstableFeatures ;
1213use rustc_span:: edition:: Edition ;
@@ -267,6 +268,8 @@ macro_rules! options {
267268 pub const parse_src_file_hash: & str = "either `md5` or `sha1`" ;
268269 pub const parse_relocation_model: & str =
269270 "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`)" ;
270273 }
271274
272275 #[ allow( dead_code) ]
@@ -606,6 +609,14 @@ macro_rules! options {
606609 true
607610 }
608611
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+
609620 fn parse_symbol_mangling_version(
610621 slot: & mut SymbolManglingVersion ,
611622 v: Option <& str >,
@@ -977,7 +988,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
977988 "measure time of each LLVM pass (default: no)" ) ,
978989 time_passes: bool = ( false , parse_bool, [ UNTRACKED ] ,
979990 "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 ] ,
981992 "choose the TLS model to use (`rustc --print tls-models` for details)" ) ,
982993 trace_macros: bool = ( false , parse_bool, [ UNTRACKED ] ,
983994 "for every macro invocation, print its name and arguments (default: no)" ) ,
0 commit comments