authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-09-05 15:35:43+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-09-06 12:15:08+02:00
log07811f47965cf850bfaba3cafdab47408d31853a
tree51da7a2e7b3b9e1ea21a70be2a1772f98586b39e
parent02e4f536d4509c4596b39c42d4526d56d88639e8

Elf2: fix crash when creating copy relocation

Accidental regression in https://codeberg.org/ziglang/zig/pulls/36413. Not sure how I didn't run into this sooner!

1 files changed, 7 insertions(+), 4 deletions(-)

src/link/Elf2.zig+7-4
......@@ -8580,10 +8580,13 @@ fn maybeAddCopyRelocation(elf: *Elf, global_name: String(.strtab)) Error!bool {
85808580 try Section.Index.data.ensureAligned(elf, dso_global.alignment);
85818581
85828582 try elf.nodes.ensureUnusedCapacity(gpa, 1);
8583 const node = try Section.Index.data.get(elf).ni.addFloatingChild(gpa, &elf.mf, .{
8584 .size = dso_global.alignment.forward(dso_global.size),
8585 .alignment = dso_global.alignment,
8586 });
8583 const node = elf.addNodeAssumeCapacity(
8584 try Section.Index.data.get(elf).ni.addFloatingChild(gpa, &elf.mf, .{
8585 .size = dso_global.alignment.forward(dso_global.size),
8586 .alignment = dso_global.alignment,
8587 }),
8588 .{ .copied_global = global_name },
8589 );
85878590 errdefer comptime unreachable;
85888591
85898592 const vaddr = elf.computeNodeVAddr(node);