aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-04 14:06:00 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-04 14:06:20 -0700
commitd65e248ed130da21e554807c8ce6add9773e0670 (patch)
tree00b96f6ff10e543266c7cb4f1655ccf2460d460c /src/link
parent9c5056788f98396ec461a1a89c4b580efe01fd62 (diff)
downloadzig-d65e248ed130da21e554807c8ce6add9773e0670.tar.gz
zig-d65e248ed130da21e554807c8ce6add9773e0670.zip
stage2: ELF: improve error reporting when libc is missing
Future improvement: make plain error notes actually render as notes rather than errors, but keep them as errors for the case of sub-compilation errors, e.g. when compiler-rt has compilation errors.
Diffstat (limited to 'src/link')
-rw-r--r--src/link/Elf.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index faeb7c9d27..f7d582bae7 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -1719,6 +1719,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
}
// libc dep
+ self.error_flags.missing_libc = false;
if (self.base.options.link_libc) {
if (self.base.options.libc_installation != null) {
const needs_grouping = self.base.options.link_mode == .Static;
@@ -1739,7 +1740,8 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
.Dynamic => "libc.so",
}));
} else {
- unreachable; // Compiler was supposed to emit an error for not being able to provide libc.
+ self.error_flags.missing_libc = true;
+ return error.FlushFailure;
}
}
}