@@ -131,6 +131,14 @@ impl SwitchWithOptPath {
131
131
}
132
132
}
133
133
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
+
134
142
#[ derive( Clone , Copy , PartialEq , Hash ) ]
135
143
pub enum DebugInfo {
136
144
None ,
@@ -838,11 +846,14 @@ macro_rules! options {
838
846
Some ( "an optional path to the profiling data output directory" ) ;
839
847
pub const parse_merge_functions: Option <& str > =
840
848
Some ( "one of: `disabled`, `trampolines`, or `aliases`" ) ;
849
+ pub const parse_symbol_mangling_version: Option <& str > =
850
+ Some ( "either `legacy` or `v0` (RFC 2603)" ) ;
841
851
}
842
852
843
853
#[ allow( dead_code) ]
844
854
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 } ;
846
857
use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy , RelroLevel } ;
847
858
use std:: path:: PathBuf ;
848
859
use std:: str :: FromStr ;
@@ -1112,6 +1123,18 @@ macro_rules! options {
1112
1123
}
1113
1124
true
1114
1125
}
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
+ }
1115
1138
}
1116
1139
) }
1117
1140
@@ -1457,6 +1480,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1457
1480
"only allow the listed language features to be enabled in code (space separated)" ) ,
1458
1481
emit_artifact_notifications: bool = ( false , parse_bool, [ UNTRACKED ] ,
1459
1482
"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" ) ,
1460
1486
}
1461
1487
1462
1488
pub fn default_lib_output ( ) -> CrateType {
@@ -2551,7 +2577,8 @@ mod dep_tracking {
2551
2577
use std:: path:: PathBuf ;
2552
2578
use std:: collections:: hash_map:: DefaultHasher ;
2553
2579
use super :: { CrateType , DebugInfo , ErrorOutputType , OptLevel , OutputTypes ,
2554
- Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath } ;
2580
+ Passes , Sanitizer , LtoCli , LinkerPluginLto , SwitchWithOptPath ,
2581
+ SymbolManglingVersion } ;
2555
2582
use syntax:: feature_gate:: UnstableFeatures ;
2556
2583
use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel , TargetTriple } ;
2557
2584
use syntax:: edition:: Edition ;
@@ -2620,6 +2647,7 @@ mod dep_tracking {
2620
2647
impl_dep_tracking_hash_via_hash ! ( Edition ) ;
2621
2648
impl_dep_tracking_hash_via_hash ! ( LinkerPluginLto ) ;
2622
2649
impl_dep_tracking_hash_via_hash ! ( SwitchWithOptPath ) ;
2650
+ impl_dep_tracking_hash_via_hash ! ( SymbolManglingVersion ) ;
2623
2651
2624
2652
impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ;
2625
2653
impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ;
@@ -2693,7 +2721,7 @@ mod tests {
2693
2721
use std:: collections:: { BTreeMap , BTreeSet } ;
2694
2722
use std:: iter:: FromIterator ;
2695
2723
use std:: path:: PathBuf ;
2696
- use super :: { Externs , OutputType , OutputTypes } ;
2724
+ use super :: { Externs , OutputType , OutputTypes , SymbolManglingVersion } ;
2697
2725
use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel } ;
2698
2726
use syntax:: symbol:: sym;
2699
2727
use syntax:: edition:: { Edition , DEFAULT_EDITION } ;
@@ -3367,6 +3395,10 @@ mod tests {
3367
3395
opts = reference. clone ( ) ;
3368
3396
opts. debugging_opts . allow_features = Some ( vec ! [ String :: from( "lang_items" ) ] ) ;
3369
3397
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( ) ) ;
3370
3402
}
3371
3403
3372
3404
#[ test]
0 commit comments