authorgravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2026-06-05 01:55:36-04:00
committergravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2026-06-23 00:26:56-04:00
log815ef725235cd4f5f0caed906bfe868225994f89
tree4382bcc66e8ddc7a2ba6d82f6b43c4df8d1257d5
parent9df2ca0d3382170a2d616d110073e7be25793778

objdump: fix --relocs not triggering object dump

- Reformat table headers

1 files changed, 14 insertions(+), 9 deletions(-)

lib/compiler/objdump.zig+14-9
......@@ -477,6 +477,7 @@ const coff = struct {
477477
478478 if (opts.section_headers or
479479 opts.file_headers or
480 opts.relocs or
480481 opts.strings or
481482 opts.symbols)
482483 {
......@@ -633,7 +634,7 @@ const coff = struct {
633634 if (load_sections) {
634635 if (opts.section_headers)
635636 try w.print(
636 \\Sections ({s}):
637 \\Sections in {s}:
637638 \\Num Name RVA Virt Size Data Size & Data & Relocs & Lines # Relocs # Lines Flags
638639 \\
639640 , .{obj_name});
......@@ -691,16 +692,17 @@ const coff = struct {
691692 if (opts.relocs)
692693 try symbol_names.ensureUnusedCapacity(gpa, header.number_of_symbols);
693694
694 if (opts.symbols) {
695 if (opts.symbols or opts.relocs) {
695696 if (header.pointer_to_symbol_table > 0) {
696697 fr.seekTo(file_location + header.pointer_to_symbol_table) catch |err|
697698 return failParse(opts, "unable to seek to symbol table: {t}", .{err});
698699
699 try w.print(
700 \\Symbols ({s}):
701 \\ Ord Value Sect Type Storage Name
702 \\
703 , .{obj_name});
700 if (opts.symbols)
701 try w.print(
702 \\Symbols in {s}:
703 \\ Ord Value Sect Type Storage Name
704 \\
705 , .{obj_name});
704706
705707 const symbol_size = std.coff.Symbol.sizeOf();
706708 var symbol_i: u32 = 0;
......@@ -733,6 +735,9 @@ const coff = struct {
733735 if (opts.relocs)
734736 symbol_names.appendNTimesAssumeCapacity(name, 1 + symbol.number_of_aux_symbols);
735737
738 if (!opts.symbols)
739 continue;
740
736741 try w.print("{x: >4} {x:0>8} ", .{ symbol_i, symbol.value });
737742 try switch (symbol.section_number) {
738743 .UNDEFINED => w.writeAll("UNDEF"),
......@@ -877,8 +882,8 @@ const coff = struct {
877882 }
878883 }
879884
880 try w.writeByte('\n');
881 } else {
885 if (opts.symbols) try w.writeByte('\n');
886 } else if (opts.symbols) {
882887 try w.writeAll("No symbol table found\n");
883888 }
884889 }