diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-10-14 13:50:10 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2021-10-22 12:50:25 +0200 |
| commit | d0dceae736edb43d4c217306a2b0445277f184ce (patch) | |
| tree | d6bad107975e61e360a50de5436fb297a97435fb /src/link.zig | |
| parent | 912e7dc54b9b49d96123ffd398e6d40b455997fe (diff) | |
| download | zig-d0dceae736edb43d4c217306a2b0445277f184ce.tar.gz zig-d0dceae736edb43d4c217306a2b0445277f184ce.zip | |
macho: dump linker's state as JSON
Each element of the output JSON has the VM address of the generated
binary nondecreasing (some elements might occupy the same VM address
for example the atom and the relocation might coincide in the address
space).
The generated JSON can be inspected manually or via a preview tool
`zig-snapshots` that I am currently working on and will allow the user
to inspect interactively the state of the linker together with the
positioning of sections, symbols, atoms and relocations within each
snapshot state, and in the future, between snapshots too. This should
allow for quicker debugging of the linker which is nontrivial when
run in the incremental mode.
Note that the state will only be dumped if the compiler is built with
`-Dlink-snapshot` flag on, and then the compiler is passed `--debug-link-snapshot`
flag upon compiling a source/project.
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/link.zig b/src/link.zig index 5874ed5703..8cb2c4a485 100644 --- a/src/link.zig +++ b/src/link.zig @@ -126,6 +126,9 @@ pub const Options = struct { /// WASI-only. Type of WASI execution model ("command" or "reactor"). wasi_exec_model: std.builtin.WasiExecModel = undefined, + /// (Zig compiler development) Enable dumping of linker's state as JSON. + enable_link_snapshots: bool = false, + pub fn effectiveOutputMode(options: Options) std.builtin.OutputMode { return if (options.use_lld) .Obj else options.output_mode; } |
