diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 8ebbe3574c..ca869f550a 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1353,12 +1353,6 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node try self.updateSymtabSize(); try self.writeSymtab(); - // Dump the state for easy debugging. - // State can be dumped via `--debug-log link_state`. - if (build_options.enable_logging) { - state_log.debug("{}", .{self.dumpState()}); - } - if (self.dwarf) |*dw| { if (self.debug_abbrev_section_dirty) { try dw.writeDbgAbbrev(); @@ -1545,6 +1539,12 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node try self.writeElfHeader(); } + // Dump the state for easy debugging. + // State can be dumped via `--debug-log link_state`. + if (build_options.enable_logging) { + state_log.debug("{}", .{self.dumpState()}); + } + // The point of flush() is to commit changes, so in theory, nothing should // be dirty after this. However, it is possible for some things to remain // dirty because they fail to be written in the event of compile errors,