diff options
| author | Casey Banner <kcbanner@gmail.com> | 2022-11-19 08:57:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-19 15:57:08 +0200 |
| commit | f746e118795af8f8eb16deefc8f6fed26f3be4dd (patch) | |
| tree | 3749fb9bae897a3b5538c6d795bd4e67e8a8220d /src/link/Coff | |
| parent | 0697883d01cb1bbdc5c34175b06eb47d5158011a (diff) | |
| download | zig-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/Coff')
| -rw-r--r-- | src/link/Coff/lld.zig | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/link/Coff/lld.zig b/src/link/Coff/lld.zig index 00e6c4d8d1..ebc2208606 100644 --- a/src/link/Coff/lld.zig +++ b/src/link/Coff/lld.zig @@ -175,7 +175,8 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod // 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.?, "lld-link" }); + const linker_command = "lld-link"; + try argv.appendSlice(&[_][]const u8{ comp.self_exe_path.?, linker_command }); try argv.append("-ERRORLIMIT:0"); try argv.append("-NOLOGO"); @@ -556,9 +557,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod 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; } }, |
