]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #52019 - michaelwoerister:cross-lto-auto-plugin, r=alexcrichton
authorkennytm <kennytm@gmail.com>
Thu, 5 Jul 2018 23:07:17 +0000 (07:07 +0800)
committerkennytm <kennytm@gmail.com>
Fri, 6 Jul 2018 00:49:20 +0000 (08:49 +0800)
[cross-lang-lto] Allow the linker to choose the LTO-plugin (which is useful when using LLD)

This PR allows for not specifying an LTO-linker plugin but still let `rustc` invoke the linker with the correct plugin arguments. This is useful when using LLD which does not need the `-plugin` argument. Since LLD is the best linker for this scenario anyway, this change should improve ergonomics quite a bit.

r? @alexcrichton

1  2 
src/librustc/session/config.rs

index f97e11ef72f490ae099f9867d215b2f37c68245f,c349def865af672e75a3aa9580002bac20d9d8b2..fdd791c5edac5844a9c8a91f5abe9acfa5a97a04
@@@ -98,6 -98,7 +98,7 @@@ pub enum Lto 
  #[derive(Clone, PartialEq, Hash)]
  pub enum CrossLangLto {
      LinkerPlugin(PathBuf),
+     LinkerPluginAuto,
      NoLink,
      Disabled
  }
@@@ -106,6 -107,7 +107,7 @@@ impl CrossLangLto 
      pub fn embed_bitcode(&self) -> bool {
          match *self {
              CrossLangLto::LinkerPlugin(_) |
+             CrossLangLto::LinkerPluginAuto |
              CrossLangLto::NoLink => true,
              CrossLangLto::Disabled => false,
          }
@@@ -1020,7 -1022,7 +1022,7 @@@ macro_rules! options 
                  let mut bool_arg = None;
                  if parse_opt_bool(&mut bool_arg, v) {
                      *slot = if bool_arg.unwrap() {
-                         CrossLangLto::NoLink
+                         CrossLangLto::LinkerPluginAuto
                      } else {
                          CrossLangLto::Disabled
                      };
@@@ -1970,13 -1972,6 +1972,13 @@@ pub fn build_session_options_and_crate_
          );
      }
  
 +    if debugging_opts.profile && incremental.is_some() {
 +        early_error(
 +            error_format,
 +            "can't instrument with gcov profiling when compiling incrementally",
 +        );
 +    }
 +
      let mut prints = Vec::<PrintRequest>::new();
      if cg.target_cpu.as_ref().map_or(false, |s| s == "help") {
          prints.push(PrintRequest::TargetCPUs);