Skip to content
/ rust Public
forked from rust-lang/rust

Commit 04442af

Browse files
committed
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 `@`
1 parent 883e746 commit 04442af

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/librustc_trans/back/command.rs

+7
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ impl Command {
132132
return false
133133
}
134134

135+
// Right now LLD doesn't support the `@` syntax of passing an argument
136+
// through files, so regardless of the platform we try to go to the OS
137+
// on this one.
138+
if let Program::Lld(..) = self.program {
139+
return false
140+
}
141+
135142
// Ok so on Windows to spawn a process is 32,768 characters in its
136143
// command line [1]. Unfortunately we don't actually have access to that
137144
// as it's calculated just before spawning. Instead we perform a

src/librustc_trans/back/link.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -827,11 +827,14 @@ fn exec_linker(sess: &Session, cmd: &mut Command, tmpdir: &Path)
827827
if !cmd.very_likely_to_exceed_some_spawn_limit() {
828828
match cmd.command().stdout(Stdio::piped()).stderr(Stdio::piped()).spawn() {
829829
Ok(child) => return child.wait_with_output(),
830-
Err(ref e) if command_line_too_big(e) => {}
830+
Err(ref e) if command_line_too_big(e) => {
831+
info!("command line to linker was too big: {}", e);
832+
}
831833
Err(e) => return Err(e)
832834
}
833835
}
834836

837+
info!("falling back to passing arguments to linker via an @-file");
835838
let mut cmd2 = cmd.clone();
836839
let mut args = String::new();
837840
for arg in cmd2.take_args() {
@@ -856,6 +859,7 @@ fn exec_linker(sess: &Session, cmd: &mut Command, tmpdir: &Path)
856859
};
857860
fs::write(&file, &bytes)?;
858861
cmd2.arg(format!("@{}", file.display()));
862+
info!("invoking linker {:?}", cmd2);
859863
return cmd2.output();
860864

861865
#[cfg(unix)]

0 commit comments

Comments
 (0)