@@ -96,18 +96,18 @@ pub enum LtoCli {
96
96
}
97
97
98
98
#[ derive( Clone , PartialEq , Hash ) ]
99
- pub enum CrossLangLto {
99
+ pub enum LinkerPluginLto {
100
100
LinkerPlugin ( PathBuf ) ,
101
101
LinkerPluginAuto ,
102
102
Disabled
103
103
}
104
104
105
- impl CrossLangLto {
105
+ impl LinkerPluginLto {
106
106
pub fn enabled ( & self ) -> bool {
107
107
match * self {
108
- CrossLangLto :: LinkerPlugin ( _) |
109
- CrossLangLto :: LinkerPluginAuto => true ,
110
- CrossLangLto :: Disabled => false ,
108
+ LinkerPluginLto :: LinkerPlugin ( _) |
109
+ LinkerPluginLto :: LinkerPluginAuto => true ,
110
+ LinkerPluginLto :: Disabled => false ,
111
111
}
112
112
}
113
113
}
@@ -812,7 +812,7 @@ macro_rules! options {
812
812
pub const parse_lto: Option <& str > =
813
813
Some ( "either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \
814
814
`fat`, or omitted") ;
815
- pub const parse_cross_lang_lto : Option <& str > =
815
+ pub const parse_linker_plugin_lto : Option <& str > =
816
816
Some ( "either a boolean (`yes`, `no`, `on`, `off`, etc), \
817
817
or the path to the linker plugin") ;
818
818
pub const parse_merge_functions: Option <& str > =
@@ -821,7 +821,7 @@ macro_rules! options {
821
821
822
822
#[ allow( dead_code) ]
823
823
mod $mod_set {
824
- use super :: { $struct_name, Passes , Sanitizer , LtoCli , CrossLangLto } ;
824
+ use super :: { $struct_name, Passes , Sanitizer , LtoCli , LinkerPluginLto } ;
825
825
use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy , RelroLevel } ;
826
826
use std:: path:: PathBuf ;
827
827
use std:: str :: FromStr ;
@@ -1037,22 +1037,22 @@ macro_rules! options {
1037
1037
true
1038
1038
}
1039
1039
1040
- fn parse_cross_lang_lto ( slot: & mut CrossLangLto , v: Option <& str >) -> bool {
1040
+ fn parse_linker_plugin_lto ( slot: & mut LinkerPluginLto , v: Option <& str >) -> bool {
1041
1041
if v. is_some( ) {
1042
1042
let mut bool_arg = None ;
1043
1043
if parse_opt_bool( & mut bool_arg, v) {
1044
1044
* slot = if bool_arg. unwrap( ) {
1045
- CrossLangLto :: LinkerPluginAuto
1045
+ LinkerPluginLto :: LinkerPluginAuto
1046
1046
} else {
1047
- CrossLangLto :: Disabled
1047
+ LinkerPluginLto :: Disabled
1048
1048
} ;
1049
1049
return true
1050
1050
}
1051
1051
}
1052
1052
1053
1053
* slot = match v {
1054
- None => CrossLangLto :: LinkerPluginAuto ,
1055
- Some ( path) => CrossLangLto :: LinkerPlugin ( PathBuf :: from( path) ) ,
1054
+ None => LinkerPluginLto :: LinkerPluginAuto ,
1055
+ Some ( path) => LinkerPluginLto :: LinkerPlugin ( PathBuf :: from( path) ) ,
1056
1056
} ;
1057
1057
true
1058
1058
}
@@ -1145,6 +1145,10 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
1145
1145
"allow the linker to link its default libraries" ) ,
1146
1146
linker_flavor: Option <LinkerFlavor > = ( None , parse_linker_flavor, [ UNTRACKED ] ,
1147
1147
"Linker flavor" ) ,
1148
+ linker_plugin_lto: LinkerPluginLto = ( LinkerPluginLto :: Disabled ,
1149
+ parse_linker_plugin_lto, [ TRACKED ] ,
1150
+ "generate build artifacts that are compatible with linker-based LTO." ) ,
1151
+
1148
1152
}
1149
1153
1150
1154
options ! { DebuggingOptions , DebuggingSetter , basic_debugging_options,
@@ -1383,8 +1387,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
1383
1387
"make the current crate share its generic instantiations" ) ,
1384
1388
chalk: bool = ( false , parse_bool, [ TRACKED ] ,
1385
1389
"enable the experimental Chalk-based trait solving engine" ) ,
1386
- cross_lang_lto: CrossLangLto = ( CrossLangLto :: Disabled , parse_cross_lang_lto, [ TRACKED ] ,
1387
- "generate build artifacts that are compatible with linker-based LTO." ) ,
1388
1390
no_parallel_llvm: bool = ( false , parse_bool, [ UNTRACKED ] ,
1389
1391
"don't run LLVM in parallel (while keeping codegen-units and ThinLTO)" ) ,
1390
1392
no_leak_check: bool = ( false , parse_bool, [ UNTRACKED ] ,
@@ -2440,7 +2442,7 @@ mod dep_tracking {
2440
2442
use std:: path:: PathBuf ;
2441
2443
use std:: collections:: hash_map:: DefaultHasher ;
2442
2444
use super :: { CrateType , DebugInfo , ErrorOutputType , OptLevel , OutputTypes ,
2443
- Passes , Sanitizer , LtoCli , CrossLangLto } ;
2445
+ Passes , Sanitizer , LtoCli , LinkerPluginLto } ;
2444
2446
use syntax:: feature_gate:: UnstableFeatures ;
2445
2447
use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel , TargetTriple } ;
2446
2448
use syntax:: edition:: Edition ;
@@ -2507,7 +2509,7 @@ mod dep_tracking {
2507
2509
impl_dep_tracking_hash_via_hash ! ( Option <Sanitizer >) ;
2508
2510
impl_dep_tracking_hash_via_hash ! ( TargetTriple ) ;
2509
2511
impl_dep_tracking_hash_via_hash ! ( Edition ) ;
2510
- impl_dep_tracking_hash_via_hash ! ( CrossLangLto ) ;
2512
+ impl_dep_tracking_hash_via_hash ! ( LinkerPluginLto ) ;
2511
2513
2512
2514
impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ;
2513
2515
impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ;
@@ -2572,7 +2574,7 @@ mod tests {
2572
2574
use crate :: lint;
2573
2575
use crate :: middle:: cstore;
2574
2576
use crate :: session:: config:: { build_configuration, build_session_options_and_crate_config} ;
2575
- use crate :: session:: config:: { LtoCli , CrossLangLto } ;
2577
+ use crate :: session:: config:: { LtoCli , LinkerPluginLto } ;
2576
2578
use crate :: session:: build_session;
2577
2579
use crate :: session:: search_paths:: SearchPath ;
2578
2580
use std:: collections:: { BTreeMap , BTreeSet } ;
@@ -3105,6 +3107,10 @@ mod tests {
3105
3107
opts = reference. clone ( ) ;
3106
3108
opts. cg . panic = Some ( PanicStrategy :: Abort ) ;
3107
3109
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
3110
+
3111
+ opts = reference. clone ( ) ;
3112
+ opts. cg . linker_plugin_lto = LinkerPluginLto :: LinkerPluginAuto ;
3113
+ assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
3108
3114
}
3109
3115
3110
3116
#[ test]
@@ -3231,10 +3237,6 @@ mod tests {
3231
3237
opts. debugging_opts . relro_level = Some ( RelroLevel :: Full ) ;
3232
3238
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
3233
3239
3234
- opts = reference. clone ( ) ;
3235
- opts. debugging_opts . cross_lang_lto = CrossLangLto :: LinkerPluginAuto ;
3236
- assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
3237
-
3238
3240
opts = reference. clone ( ) ;
3239
3241
opts. debugging_opts . merge_functions = Some ( MergeFunctions :: Disabled ) ;
3240
3242
assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
0 commit comments