Skip to content

Commit

Permalink
coff: add hook for printing directives
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Mar 19, 2024
1 parent 856a4b0 commit 5f6dc15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Object.zig
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub fn print(self: *Object, writer: anytype, options: anytype) !void {
}

if (options.headers) try self.printHeaders(writer);
if (options.directives) try self.printDirectives(writer);

var base_relocs_dir: ?coff.ImageDataDirectory = null;
var imports_dir: ?coff.ImageDataDirectory = null;
Expand Down Expand Up @@ -406,6 +407,11 @@ fn printSectionHeader(self: *Object, writer: anytype, sect_id: u16, sect_hdr: *a
try writer.writeByte('\n');
}

fn printDirectives(self: *Object, writer: anytype) !void {
_ = self;
_ = writer;
}

fn printRelocations(self: *Object, writer: anytype, sect_id: u16, sect_hdr: *align(1) const coff.SectionHeader) !void {
try writer.print("RELOCATIONS #{X}\n\n", .{sect_id + 1});
const machine = self.getCoffHeader().machine;
Expand Down
3 changes: 3 additions & 0 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ pub fn main() !void {
while (p.hasMore()) {
if (p.flagAny("help") or p.flagWindows("?")) {
fatal(usage, .{});
} else if (p.flagAny("directives")) {
print_matrix.directives = true;
} else if (p.flagAny("headers")) {
print_matrix.headers = true;
} else if (p.flagAny("symbols")) {
Expand Down Expand Up @@ -141,6 +143,7 @@ pub fn main() !void {
}

pub const PrintMatrix = packed struct {
directives: bool = false,
headers: bool = false,
symbols: bool = false,
imports: bool = false,
Expand Down

0 comments on commit 5f6dc15

Please sign in to comment.