| ... | ... | @@ -477,6 +477,7 @@ const coff = struct { |
| 477 | 477 | |
| 478 | 478 | if (opts.section_headers or |
| 479 | 479 | opts.file_headers or |
| 480 | opts.relocs or |
| 480 | 481 | opts.strings or |
| 481 | 482 | opts.symbols) |
| 482 | 483 | { |
| ... | ... | @@ -633,7 +634,7 @@ const coff = struct { |
| 633 | 634 | if (load_sections) { |
| 634 | 635 | if (opts.section_headers) |
| 635 | 636 | try w.print( |
| 636 | | \\Sections ({s}): |
| 637 | \\Sections in {s}: |
| 637 | 638 | \\Num Name RVA Virt Size Data Size & Data & Relocs & Lines # Relocs # Lines Flags |
| 638 | 639 | \\ |
| 639 | 640 | , .{obj_name}); |
| ... | ... | @@ -691,16 +692,17 @@ const coff = struct { |
| 691 | 692 | if (opts.relocs) |
| 692 | 693 | try symbol_names.ensureUnusedCapacity(gpa, header.number_of_symbols); |
| 693 | 694 | |
| 694 | | if (opts.symbols) { |
| 695 | if (opts.symbols or opts.relocs) { |
| 695 | 696 | if (header.pointer_to_symbol_table > 0) { |
| 696 | 697 | fr.seekTo(file_location + header.pointer_to_symbol_table) catch |err| |
| 697 | 698 | return failParse(opts, "unable to seek to symbol table: {t}", .{err}); |
| 698 | 699 | |
| 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}); |
| 704 | 706 | |
| 705 | 707 | const symbol_size = std.coff.Symbol.sizeOf(); |
| 706 | 708 | var symbol_i: u32 = 0; |
| ... | ... | @@ -733,6 +735,9 @@ const coff = struct { |
| 733 | 735 | if (opts.relocs) |
| 734 | 736 | symbol_names.appendNTimesAssumeCapacity(name, 1 + symbol.number_of_aux_symbols); |
| 735 | 737 | |
| 738 | if (!opts.symbols) |
| 739 | continue; |
| 740 | |
| 736 | 741 | try w.print("{x: >4} {x:0>8} ", .{ symbol_i, symbol.value }); |
| 737 | 742 | try switch (symbol.section_number) { |
| 738 | 743 | .UNDEFINED => w.writeAll("UNDEF"), |
| ... | ... | @@ -877,8 +882,8 @@ const coff = struct { |
| 877 | 882 | } |
| 878 | 883 | } |
| 879 | 884 | |
| 880 | | try w.writeByte('\n'); |
| 881 | | } else { |
| 885 | if (opts.symbols) try w.writeByte('\n'); |
| 886 | } else if (opts.symbols) { |
| 882 | 887 | try w.writeAll("No symbol table found\n"); |
| 883 | 888 | } |
| 884 | 889 | } |