@@ -96,18 +96,18 @@ pub enum LtoCli {
9696}
9797
9898#[ derive( Clone , PartialEq , Hash ) ]
99- pub enum CrossLangLto {
99+ pub enum LinkerPluginLto {
100100 LinkerPlugin ( PathBuf ) ,
101101 LinkerPluginAuto ,
102102 Disabled
103103}
104104
105- impl CrossLangLto {
105+ impl LinkerPluginLto {
106106 pub fn enabled ( & self ) -> bool {
107107 match * self {
108- CrossLangLto :: LinkerPlugin ( _) |
109- CrossLangLto :: LinkerPluginAuto => true ,
110- CrossLangLto :: Disabled => false ,
108+ LinkerPluginLto :: LinkerPlugin ( _) |
109+ LinkerPluginLto :: LinkerPluginAuto => true ,
110+ LinkerPluginLto :: Disabled => false ,
111111 }
112112 }
113113}
@@ -812,7 +812,7 @@ macro_rules! options {
812812 pub const parse_lto: Option <& str > =
813813 Some ( "either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \
814814 `fat`, or omitted") ;
815- pub const parse_cross_lang_lto : Option <& str > =
815+ pub const parse_linker_plugin_lto : Option <& str > =
816816 Some ( "either a boolean (`yes`, `no`, `on`, `off`, etc), \
817817 or the path to the linker plugin") ;
818818 pub const parse_merge_functions: Option <& str > =
@@ -821,7 +821,7 @@ macro_rules! options {
821821
822822 #[ allow( dead_code) ]
823823 mod $mod_set {
824- use super :: { $struct_name, Passes , Sanitizer , LtoCli , CrossLangLto } ;
824+ use super :: { $struct_name, Passes , Sanitizer , LtoCli , LinkerPluginLto } ;
825825 use rustc_target:: spec:: { LinkerFlavor , MergeFunctions , PanicStrategy , RelroLevel } ;
826826 use std:: path:: PathBuf ;
827827 use std:: str :: FromStr ;
@@ -1037,22 +1037,22 @@ macro_rules! options {
10371037 true
10381038 }
10391039
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 {
10411041 if v. is_some( ) {
10421042 let mut bool_arg = None ;
10431043 if parse_opt_bool( & mut bool_arg, v) {
10441044 * slot = if bool_arg. unwrap( ) {
1045- CrossLangLto :: LinkerPluginAuto
1045+ LinkerPluginLto :: LinkerPluginAuto
10461046 } else {
1047- CrossLangLto :: Disabled
1047+ LinkerPluginLto :: Disabled
10481048 } ;
10491049 return true
10501050 }
10511051 }
10521052
10531053 * 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) ) ,
10561056 } ;
10571057 true
10581058 }
@@ -1145,6 +1145,10 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
11451145 "allow the linker to link its default libraries" ) ,
11461146 linker_flavor: Option <LinkerFlavor > = ( None , parse_linker_flavor, [ UNTRACKED ] ,
11471147 "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+
11481152}
11491153
11501154options ! { DebuggingOptions , DebuggingSetter , basic_debugging_options,
@@ -1383,8 +1387,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13831387 "make the current crate share its generic instantiations" ) ,
13841388 chalk: bool = ( false , parse_bool, [ TRACKED ] ,
13851389 "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." ) ,
13881390 no_parallel_llvm: bool = ( false , parse_bool, [ UNTRACKED ] ,
13891391 "don't run LLVM in parallel (while keeping codegen-units and ThinLTO)" ) ,
13901392 no_leak_check: bool = ( false , parse_bool, [ UNTRACKED ] ,
@@ -2440,7 +2442,7 @@ mod dep_tracking {
24402442 use std:: path:: PathBuf ;
24412443 use std:: collections:: hash_map:: DefaultHasher ;
24422444 use super :: { CrateType , DebugInfo , ErrorOutputType , OptLevel , OutputTypes ,
2443- Passes , Sanitizer , LtoCli , CrossLangLto } ;
2445+ Passes , Sanitizer , LtoCli , LinkerPluginLto } ;
24442446 use syntax:: feature_gate:: UnstableFeatures ;
24452447 use rustc_target:: spec:: { MergeFunctions , PanicStrategy , RelroLevel , TargetTriple } ;
24462448 use syntax:: edition:: Edition ;
@@ -2507,7 +2509,7 @@ mod dep_tracking {
25072509 impl_dep_tracking_hash_via_hash ! ( Option <Sanitizer >) ;
25082510 impl_dep_tracking_hash_via_hash ! ( TargetTriple ) ;
25092511 impl_dep_tracking_hash_via_hash ! ( Edition ) ;
2510- impl_dep_tracking_hash_via_hash ! ( CrossLangLto ) ;
2512+ impl_dep_tracking_hash_via_hash ! ( LinkerPluginLto ) ;
25112513
25122514 impl_dep_tracking_hash_for_sortable_vec_of ! ( String ) ;
25132515 impl_dep_tracking_hash_for_sortable_vec_of ! ( PathBuf ) ;
@@ -2572,7 +2574,7 @@ mod tests {
25722574 use crate :: lint;
25732575 use crate :: middle:: cstore;
25742576 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 } ;
25762578 use crate :: session:: build_session;
25772579 use crate :: session:: search_paths:: SearchPath ;
25782580 use std:: collections:: { BTreeMap , BTreeSet } ;
@@ -3105,6 +3107,10 @@ mod tests {
31053107 opts = reference. clone ( ) ;
31063108 opts. cg . panic = Some ( PanicStrategy :: Abort ) ;
31073109 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( ) ) ;
31083114 }
31093115
31103116 #[ test]
@@ -3231,10 +3237,6 @@ mod tests {
32313237 opts. debugging_opts . relro_level = Some ( RelroLevel :: Full ) ;
32323238 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
32333239
3234- opts = reference. clone ( ) ;
3235- opts. debugging_opts . cross_lang_lto = CrossLangLto :: LinkerPluginAuto ;
3236- assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
3237-
32383240 opts = reference. clone ( ) ;
32393241 opts. debugging_opts . merge_functions = Some ( MergeFunctions :: Disabled ) ;
32403242 assert ! ( reference. dep_tracking_hash( ) != opts. dep_tracking_hash( ) ) ;
0 commit comments