Skip to content

Commit

Permalink
macho: tmp dump
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Jan 23, 2024
1 parent f39557e commit 5be74da
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/MachO/synthetic.zig
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,20 @@ pub const LaSymbolPtrSection = struct {
_ = laptr;
const cpu_arch = macho_file.options.cpu_arch.?;
const sect = macho_file.sections.items(.header)[macho_file.stubs_helper_sect_index.?];
for (macho_file.stubs.symbols.items, 0..) |sym_index, idx| {
var stub_helper_idx: u32 = 0;
for (macho_file.stubs.symbols.items) |sym_index| {
const sym = macho_file.getSymbol(sym_index);
const value: u64 = if (sym.flags.@"export")
sym.getAddress(.{ .stubs = false }, macho_file)
else if (sym.flags.weak)
@as(u64, 0)
else
sect.addr + StubsHelperSection.preambleSize(cpu_arch) +
StubsHelperSection.entrySize(cpu_arch) * idx;
else value: {
const value = sect.addr + StubsHelperSection.preambleSize(cpu_arch) +
StubsHelperSection.entrySize(cpu_arch) * stub_helper_idx;
stub_helper_idx += 1;
break :value value;
};
std.debug.print("{s}@{x}\n", .{ sym.getName(macho_file), value });
try writer.writeInt(u64, @intCast(value), .little);
}
}
Expand Down

0 comments on commit 5be74da

Please sign in to comment.