| ... | @@ -920,7 +920,7 @@ fn markRelocsDirtyByTarget(self: *Coff, target: SymbolWithLoc) void { | ... | @@ -920,7 +920,7 @@ fn markRelocsDirtyByTarget(self: *Coff, target: SymbolWithLoc) void { |
| 920 | fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void { | 920 | fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void { |
| 921 | const got_moved = blk: { | 921 | const got_moved = blk: { |
| 922 | const sect_id = self.got_section_index orelse break :blk false; | 922 | const sect_id = self.got_section_index orelse break :blk false; |
| 923 | break :blk self.sections.items(.header)[sect_id].virtual_address > addr; | 923 | break :blk self.sections.items(.header)[sect_id].virtual_address >= addr; |
| 924 | }; | 924 | }; |
| 925 | | 925 | |
| 926 | // TODO: dirty relocations targeting import table if that got moved in memory | 926 | // TODO: dirty relocations targeting import table if that got moved in memory |
| ... | @@ -931,7 +931,7 @@ fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void { | ... | @@ -931,7 +931,7 @@ fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void { |
| 931 | reloc.dirty = reloc.dirty or got_moved; | 931 | reloc.dirty = reloc.dirty or got_moved; |
| 932 | } else { | 932 | } else { |
| 933 | const target_vaddr = reloc.getTargetAddress(self) orelse continue; | 933 | const target_vaddr = reloc.getTargetAddress(self) orelse continue; |
| 934 | if (target_vaddr > addr) reloc.dirty = true; | 934 | if (target_vaddr >= addr) reloc.dirty = true; |
| 935 | } | 935 | } |
| 936 | } | 936 | } |
| 937 | } | 937 | } |
| ... | @@ -939,7 +939,7 @@ fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void { | ... | @@ -939,7 +939,7 @@ fn markRelocsDirtyByAddress(self: *Coff, addr: u32) void { |
| 939 | // TODO: dirty only really affected GOT cells | 939 | // TODO: dirty only really affected GOT cells |
| 940 | for (self.got_table.entries.items) |entry| { | 940 | for (self.got_table.entries.items) |entry| { |
| 941 | const target_addr = self.getSymbol(entry).value; | 941 | const target_addr = self.getSymbol(entry).value; |
| 942 | if (target_addr > addr) { | 942 | if (target_addr >= addr) { |
| 943 | self.got_table_contents_dirty = true; | 943 | self.got_table_contents_dirty = true; |
| 944 | break; | 944 | break; |
| 945 | } | 945 | } |
| ... | @@ -1722,6 +1722,7 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod | ... | @@ -1722,6 +1722,7 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod |
| 1722 | var code = std.ArrayList(u8).init(gpa); | 1722 | var code = std.ArrayList(u8).init(gpa); |
| 1723 | defer code.deinit(); | 1723 | defer code.deinit(); |
| 1724 | try code.resize(math.cast(usize, atom.size) orelse return error.Overflow); | 1724 | try code.resize(math.cast(usize, atom.size) orelse return error.Overflow); |
| | 1725 | assert(atom.size > 0); |
| 1725 | | 1726 | |
| 1726 | const amt = try self.base.file.?.preadAll(code.items, file_offset); | 1727 | const amt = try self.base.file.?.preadAll(code.items, file_offset); |
| 1727 | if (amt != code.items.len) return error.InputOutput; | 1728 | if (amt != code.items.len) return error.InputOutput; |