about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-03-14 16:29:51 +0800
committerkennytm <kennytm@gmail.com>2018-03-15 00:15:51 +0800
commit088bf643bdbca5228648e6459911015b56f8d2f8 (patch)
tree8af961f9d062e98efc5c77e85008517795185bad /src
parentff80cde998fd1068757ef788b1be51e7df4a7192 (diff)
parent04442af18bf01622288a33faa58caf7e666cac40 (diff)
Rollup merge of #48981 - alexcrichton:lld-no-at-file, r=michaelwoerister
rustc: Don't invoke `lld` with an `@`-file

Looks like LLD doesn't support this yet, so always try to use the OS before we
fall back to using `@`

cc https://github.com/rust-lang/rust/issues/48948
Diffstat (limited to 'src')
-rw-r--r--src/librustc_trans/back/command.rs7
-rw-r--r--src/librustc_trans/back/link.rs6
2 files changed, 12 insertions, 1 deletions
diff --git a/src/librustc_trans/back/command.rs b/src/librustc_trans/back/command.rs
index ecf7bf5036e..a5649e98baa 100644
--- a/src/librustc_trans/back/command.rs
+++ b/src/librustc_trans/back/command.rs
@@ -132,6 +132,13 @@ impl Command {
             return false
         }
 
+        // Right now LLD doesn't support the `@` syntax of passing an argument
+        // through files, so regardless of the platform we try to go to the OS
+        // on this one.
+        if let Program::Lld(..) = self.program {
+            return false
+        }
+
         // Ok so on Windows to spawn a process is 32,768 characters in its
         // command line [1]. Unfortunately we don't actually have access to that
         // as it's calculated just before spawning. Instead we perform a
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 867498d0c59..bdda7741221 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -827,11 +827,14 @@ fn exec_linker(sess: &Session, cmd: &mut Command, tmpdir: &Path)
     if !cmd.very_likely_to_exceed_some_spawn_limit() {
         match cmd.command().stdout(Stdio::piped()).stderr(Stdio::piped()).spawn() {
             Ok(child) => return child.wait_with_output(),
-            Err(ref e) if command_line_too_big(e) => {}
+            Err(ref e) if command_line_too_big(e) => {
+                info!("command line to linker was too big: {}", e);
+            }
             Err(e) => return Err(e)
         }
     }
 
+    info!("falling back to passing arguments to linker via an @-file");
     let mut cmd2 = cmd.clone();
     let mut args = String::new();
     for arg in cmd2.take_args() {
@@ -856,6 +859,7 @@ fn exec_linker(sess: &Session, cmd: &mut Command, tmpdir: &Path)
     };
     fs::write(&file, &bytes)?;
     cmd2.arg(format!("@{}", file.display()));
+    info!("invoking linker {:?}", cmd2);
     return cmd2.output();
 
     #[cfg(unix)]