mirror of
https://github.com/ziglang/zig.git
synced 2025-12-31 18:43:18 +00:00
coff: mark dirty any reloc target at [addr,..) inclusive
This commit is contained in:
parent
8c748d5fd7
commit
028bfdbca3
@ -920,7 +920,7 @@ fn markRelocsDirtyByTarget(self: *Coff, target: SymbolWithLoc) void {
|
||||
fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void {
|
||||
const got_moved = blk: {
|
||||
const sect_id = self.got_section_index orelse break :blk false;
|
||||
break :blk self.sections.items(.header)[sect_id].virtual_address > addr;
|
||||
break :blk self.sections.items(.header)[sect_id].virtual_address >= addr;
|
||||
};
|
||||
|
||||
// TODO: dirty relocations targeting import table if that got moved in memory
|
||||
@ -931,7 +931,7 @@ fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void {
|
||||
reloc.dirty = reloc.dirty or got_moved;
|
||||
} else {
|
||||
const target_vaddr = reloc.getTargetAddress(self) orelse continue;
|
||||
if (target_vaddr > addr) reloc.dirty = true;
|
||||
if (target_vaddr >= addr) reloc.dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -939,7 +939,7 @@ fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void {
|
||||
// TODO: dirty only really affected GOT cells
|
||||
for (self.got_table.entries.items) |entry| {
|
||||
const target_addr = self.getSymbol(entry).value;
|
||||
if (target_addr > addr) {
|
||||
if (target_addr >= addr) {
|
||||
self.got_table_contents_dirty = true;
|
||||
break;
|
||||
}
|
||||
@ -1722,6 +1722,7 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
|
||||
var code = std.ArrayList(u8).init(gpa);
|
||||
defer code.deinit();
|
||||
try code.resize(math.cast(usize, atom.size) orelse return error.Overflow);
|
||||
assert(atom.size > 0);
|
||||
|
||||
const amt = try self.base.file.?.preadAll(code.items, file_offset);
|
||||
if (amt != code.items.len) return error.InputOutput;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user