aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorMotiejus Jakštys <motiejus@jakstys.lt>2022-05-09 09:44:14 +0300
committerAndrew Kelley <andrew@ziglang.org>2022-09-08 22:30:32 -0400
commita833bdcd7e6fcfee6e9cc33a3f7de78b16a36941 (patch)
tree5b45c1662789e9743d328356167b3dce72495bfd /src/link
parentab4b26d8a6a36ccf75af8e25f0a1f7b88063b76f (diff)
downloadzig-a833bdcd7e6fcfee6e9cc33a3f7de78b16a36941.tar.gz
zig-a833bdcd7e6fcfee6e9cc33a3f7de78b16a36941.zip
[ld] add --print-* for diagnostics
This adds the following for passthrough to lld: - `--print-gc-sections` - `--print-icf-sections` - `--print-map` I am not adding these to the cache manifest, since it does not change the produced artifacts. Tested with an example from #11398: it successfully prints the resulting map and the GC'd sections.
Diffstat (limited to 'src/link')
-rw-r--r--src/link/Elf.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index e63fa07187..1d49198937 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -1482,6 +1482,18 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
try argv.append("--gc-sections");
}
+ if (self.base.options.print_gc_sections) {
+ try argv.append("--print-gc-sections");
+ }
+
+ if (self.base.options.print_icf_sections) {
+ try argv.append("--print-icf-sections");
+ }
+
+ if (self.base.options.print_map) {
+ try argv.append("--print-map");
+ }
+
if (self.base.options.eh_frame_hdr) {
try argv.append("--eh-frame-hdr");
}