@@ -13,8 +13,8 @@ use rustc_span::edition::Edition;
1313use rustc_span:: { RealFileName , SourceFileHashAlgorithm } ;
1414use rustc_target:: spec:: {
1515 CodeModel , FramePointer , LinkerFlavorCli , MergeFunctions , OnBrokenPipe , PanicStrategy ,
16- RelocModel , RelroLevel , SanitizerSet , SplitDebuginfo , StackProtector , TargetTriple , TlsModel ,
17- WasmCAbi ,
16+ RelocModel , RelroLevel , SanitizerSet , SplitDebuginfo , StackProtector , SymbolVisibility ,
17+ TargetTriple , TlsModel , WasmCAbi ,
1818} ;
1919
2020use crate :: config:: * ;
@@ -416,6 +416,8 @@ mod desc {
416416 "one of: `disabled`, `trampolines`, or `aliases`" ;
417417 pub ( crate ) const parse_symbol_mangling_version: & str =
418418 "one of: `legacy`, `v0` (RFC 2603), or `hashed`" ;
419+ pub ( crate ) const parse_opt_symbol_visibility: & str =
420+ "one of: `hidden`, `protected`, or `interposable`" ;
419421 pub ( crate ) const parse_src_file_hash: & str = "either `md5` or `sha1`" ;
420422 pub ( crate ) const parse_relocation_model: & str =
421423 "one of supported relocation models (`rustc --print relocation-models`)" ;
@@ -922,6 +924,20 @@ mod parse {
922924 true
923925 }
924926
927+ pub ( crate ) fn parse_opt_symbol_visibility (
928+ slot : & mut Option < SymbolVisibility > ,
929+ v : Option < & str > ,
930+ ) -> bool {
931+ if let Some ( v) = v {
932+ if let Ok ( vis) = SymbolVisibility :: from_str ( v) {
933+ * slot = Some ( vis) ;
934+ } else {
935+ return false ;
936+ }
937+ }
938+ true
939+ }
940+
925941 pub ( crate ) fn parse_optimization_fuel (
926942 slot : & mut Option < ( String , u64 ) > ,
927943 v : Option < & str > ,
@@ -1688,8 +1704,8 @@ options! {
16881704 "compress debug info sections (none, zlib, zstd, default: none)" ) ,
16891705 deduplicate_diagnostics: bool = ( true , parse_bool, [ UNTRACKED ] ,
16901706 "deduplicate identical diagnostics (default: yes)" ) ,
1691- default_hidden_visibility : Option <bool > = ( None , parse_opt_bool , [ TRACKED ] ,
1692- "overrides the `default_hidden_visibility ` setting of the target" ) ,
1707+ default_visibility : Option <SymbolVisibility > = ( None , parse_opt_symbol_visibility , [ TRACKED ] ,
1708+ "overrides the `default_visibility ` setting of the target" ) ,
16931709 dep_info_omit_d_target: bool = ( false , parse_bool, [ TRACKED ] ,
16941710 "in dep-info output, omit targets for tracking dependencies of the dep-info files \
16951711 themselves (default: no)") ,
0 commit comments