aboutsummaryrefslogtreecommitdiff
path: root/src/link/Wasm.zig
diff options
context:
space:
mode:
authorCasey Banner <kcbanner@gmail.com>2022-11-19 08:57:08 -0500
committerGitHub <noreply@github.com>2022-11-19 15:57:08 +0200
commitf746e118795af8f8eb16deefc8f6fed26f3be4dd (patch)
tree3749fb9bae897a3b5538c6d795bd4e67e8a8220d /src/link/Wasm.zig
parent0697883d01cb1bbdc5c34175b06eb47d5158011a (diff)
downloadzig-f746e118795af8f8eb16deefc8f6fed26f3be4dd.tar.gz
zig-f746e118795af8f8eb16deefc8f6fed26f3be4dd.zip
linker: fail the compilation if there were linker errors
There was no check for linker errors after flushing, which meant that if the link failed the build would continue and try to copy the non-existant exe, and also write the manifest as if it had succeeded. Also adds parsing of lld output, which is surfaced at the end of the compilation with the other errors instead of via stderr
Diffstat (limited to 'src/link/Wasm.zig')
-rw-r--r--src/link/Wasm.zig7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index b9f2d74bd8..39f8a6bbe6 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -3125,7 +3125,8 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
// We will invoke ourselves as a child process to gain access to LLD.
// This is necessary because LLD does not behave properly as a library -
// it calls exit() and does not reset all global data between invocations.
- try argv.appendSlice(&[_][]const u8{ comp.self_exe_path.?, "wasm-ld" });
+ const linker_command = "wasm-ld";
+ try argv.appendSlice(&[_][]const u8{ comp.self_exe_path.?, linker_command });
try argv.append("--error-limit=0");
if (wasm.base.options.lto) {
@@ -3357,9 +3358,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
switch (term) {
.Exited => |code| {
if (code != 0) {
- // TODO parse this output and surface with the Compilation API rather than
- // directly outputting to stderr here.
- std.debug.print("{s}", .{stderr});
+ comp.lockAndParseLldStderr(linker_command, stderr);
return error.LLDReportedFailure;
}
},