zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 7aefea614f570f489366a7fbde1a98eaf2551fc6 (tree)
parent 3bdb3b574e36962528d203a69ee1de4b39e17830
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Sat, 10 Jul 2021 14:35:20 +0200

zld: fix allocating tentative defs

Diffstat:
Msrc/link/MachO/Zld.zig | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/link/MachO/Zld.zig b/src/link/MachO/Zld.zig @@ -1603,6 +1603,17 @@ fn resolveSymbols(self: *Zld) !void { block.size = size; block.alignment = alignment; + // Update target section's metadata + // TODO should we update segment's size here too? + // How does it tie with incremental space allocs? + const tseg = &self.load_commands.items[match.seg].Segment; + const tsect = &tseg.sections.items[match.sect]; + const new_alignment = math.max(tsect.@"align", block.alignment); + const new_alignment_pow_2 = try math.powi(u32, 2, new_alignment); + const new_size = mem.alignForwardGeneric(u64, tsect.size + block.size, new_alignment_pow_2); + tsect.size = new_size; + tsect.@"align" = new_alignment; + if (self.blocks.getPtr(match)) |last| { last.*.next = block; block.prev = last.*;