authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-08-16 10:15:26+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-08-16 10:37:20+01:00
loge9e0ce6c605e36c355fe4b137b795ed935e1e8f3
tree63b22018aa3d7ebcd1b5906d0c06acd74ae0768b
parent29bcd2d54376f6b15a6900b264e8b4d99e7b186a
signaturelock-open Commit is signed but in an unrecognized format.

Elf2: fix exporting UAVs which are otherwise dead


1 files changed, 12 insertions(+), 12 deletions(-)

src/link/Elf2.zig+12-12
...@@ -8727,31 +8727,31 @@ fn updateExportInner(...@@ -8727,31 +8727,31 @@ fn updateExportInner(
8727 }),8727 }),
8728 }8728 }
8729 try elf.ensureUnusedSymbolCapacity(1, .maybe_global);8729 try elf.ensureUnusedSymbolCapacity(1, .maybe_global);
8730 const exported_lsi: Symbol.LocalIndex, const @"type": std.elf.STT = switch (@"export".exported) {8730 const exported_lsi: Symbol.LocalIndex = switch (@"export".exported) {
8731 .nav => |nav| .{8731 .nav => |nav| (try elf.navMapIndex(zcu, nav)).symbol(elf),
8732 (try elf.navMapIndex(zcu, nav)).symbol(elf),8732 .uav => |uav| (try elf.uavMapIndex(uav, .none)).symbol(elf),
8733 elf.navType(ip.getNav(nav).resolved.?),
8734 },
8735 .uav => |uav| .{ (try elf.uavMapIndex(uav, .none)).symbol(elf), .OBJECT },
8736 };8733 };
87378734
8738 try elf.ensureElfNodeSize();8735 try elf.ensureElfNodeSize();
8739 while (try elf.idle(pt.tid)) {}
87408736
8741 const value: u64 = Symbol.Id.local(exported_lsi).value(elf);8737 // Initialize the global symbol with the same values that the local one currently has. If the
8742 const size: u64, const shndx: Section.Index = switch (elf.symPtr(exported_lsi.index())) {8738 // NAV/UAV is updated, then `updateNavInner` or `genUav` will update the global symbol sizes,
8739 // and `flushMoved` will update their values.
8740 const cur_value: u64, const cur_size: u64, const @"type": std.elf.STT, const shndx: Section.Index = switch (elf.symPtr(exported_lsi.index())) {
8743 inline else => |exported_sym| .{8741 inline else => |exported_sym| .{
8742 elf.targetLoad(&exported_sym.value),
8744 elf.targetLoad(&exported_sym.size),8743 elf.targetLoad(&exported_sym.size),
8744 elf.targetLoad(&exported_sym.info).type,
8745 .fromSection(elf.targetLoad(&exported_sym.shndx)),8745 .fromSection(elf.targetLoad(&exported_sym.shndx)),
8746 },8746 },
8747 };8747 };
87488748
8749 const name = @"export".opts.name.toSlice(ip);8749 const name = @"export".opts.name.toSlice(ip);
8750 _ = elf.addGlobalSymbolAssumeCapacity(.{8750 _ = elf.addGlobalSymbolAssumeCapacity(.{
8751 .node = .none,8751 .node = exported_lsi.index().ptr(elf).node,
8752 .name = try .string(elf, name),8752 .name = try .string(elf, name),
8753 .value = value,8753 .value = cur_value,
8754 .size = @intCast(size),8754 .size = cur_size,
8755 .type = @"type",8755 .type = @"type",
8756 .bind = switch (@"export".opts.linkage) {8756 .bind = switch (@"export".opts.linkage) {
8757 .strong => .strong,8757 .strong => .strong,