@@ -131,6 +131,14 @@ impl SwitchWithOptPath {
131131 }
132132}
133133
134+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash , RustcEncodable , RustcDecodable ) ]
135+ pub enum SymbolManglingVersion {
136+ Legacy ,
137+ V0 ,
138+ }
139+
140+ impl_stable_hash_via_hash ! ( SymbolManglingVersion ) ;
141+
134142#[ derive( Clone , Copy , PartialEq , Hash ) ]
135143pub enum DebugInfo {
136144 None ,
@@ -838,11 +846,14 @@ macro_rules! options {
838846 Some ( "an optional path to the profiling data output directory" ) ;
839847 pub const parse_merge_functions: Option <& str > =
840848 Some ( "one of: `disabled`, `trampolines`, or `aliases`" ) ;
849+ pub const parse_symbol_mangling_version: Option <& str > =
850+ Some ( "either `legacy` or `v0` (RFC 2603)" ) ;
841851 }
842852
843853 #[ allow( dead_code) ]
844854 mod $mod_set {
845- use super :: { $struct_name, Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath } ;
855+ use super :: { $struct_name, Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath ,
856+ SymbolManglingVersion } ;
846857 use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy , RelroLevel } ;
847858 use std:: path:: PathBuf ;
848859 use std:: str :: FromStr ;
@@ -1112,6 +1123,18 @@ macro_rules! options {
11121123 }
11131124 true
11141125 }
1126+
1127+ fn parse_symbol_mangling_version(
1128+ slot: & mut SymbolManglingVersion ,
1129+ v: Option <& str >,
1130+ ) -> bool {
1131+ * slot = match v {
1132+ Some ( "legacy" ) => SymbolManglingVersion :: Legacy ,
1133+ Some ( "v0" ) => SymbolManglingVersion :: V0 ,
1134+ _ => return false ,
1135+ } ;
1136+ true
1137+ }
11151138 }
11161139) }
11171140
@@ -1457,6 +1480,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
14571480 "only allow the listed language features to be enabled in code (space separated)" ) ,
14581481 emit_artifact_notifications: bool = ( false , parse_bool, [ UNTRACKED ] ,
14591482 "emit notifications after each artifact has been output (only in the JSON format)" ) ,
1483+ symbol_mangling_version: SymbolManglingVersion = ( SymbolManglingVersion :: Legacy ,
1484+ parse_symbol_mangling_version, [ TRACKED ] ,
1485+ "which mangling version to use for symbol names" ) ,
14601486}
14611487
14621488pub fn default_lib_output ( ) -> CrateType {
@@ -2551,7 +2577,8 @@ mod dep_tracking {
25512577 use std:: path:: PathBuf ;
25522578 use std:: collections:: hash_map:: DefaultHasher ;
25532579 use super :: { CrateType , DebugInfo , ErrorOutputType , OptLevel , OutputTypes ,
2554- Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath } ;
2580+ Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath ,
2581+ SymbolManglingVersion } ;
25552582 use syntax:: feature_gate:: UnstableFeatures ;
25562583 use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel , TargetTriple } ;
25572584 use syntax:: edition:: Edition ;
@@ -2620,6 +2647,7 @@ mod dep_tracking {
26202647 impl_dep_tracking_hash_via_hash ! ( Edition ) ;
26212648 impl_dep_tracking_hash_via_hash ! ( LinkerPluginLto ) ;
26222649 impl_dep_tracking_hash_via_hash ! ( SwitchWithOptPath ) ;
2650+ impl_dep_tracking_hash_via_hash ! ( SymbolManglingVersion ) ;
26232651
26242652 impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ;
26252653 impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ;
@@ -2693,7 +2721,7 @@ mod tests {
26932721 use std:: collections:: { BTreeMap , BTreeSet } ;
26942722 use std:: iter:: FromIterator ;
26952723 use std:: path:: PathBuf ;
2696- use super :: { Externs , OutputType , OutputTypes } ;
2724+ use super :: { Externs , OutputType , OutputTypes , SymbolManglingVersion } ;
26972725 use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel } ;
26982726 use syntax:: symbol:: sym;
26992727 use syntax:: edition:: { Edition , DEFAULT_EDITION } ;
@@ -3367,6 +3395,10 @@ mod tests {
33673395 opts = reference. clone ( ) ;
33683396 opts. debugging_opts . allow_features = Some ( vec ! [ String :: from( "lang_items" ) ] ) ;
33693397 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
3398+
3399+ opts = reference. clone ( ) ;
3400+ opts. debugging_opts . symbol_mangling_version = SymbolManglingVersion :: V0 ;
3401+ assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
33703402 }
33713403
33723404 #[ test]
0 commit comments