authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-12 10:42:29-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-12 10:44:17-07:00
log49637f537269ed98efb95a82e63ef73f6a9606a9
treeebcbddf7e952423690a6f5ba46f4e7ea0e39aebb
parent344a21b14f8ddcd30d376953e2f4c6a81eae2ccb

objcopy: check both global and local when remapping


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

lib/compiler/objcopy.zig+4-7
......@@ -1179,13 +1179,10 @@ fn ElfFile(comptime is_64: bool) type {
11791179 @memcpy(data, src_data);
11801180
11811181 const defs = @as([*]elf.Verdef, @ptrCast(data))[0 .. @as(usize, @intCast(src.sh_size)) / @sizeOf(elf.Verdef)];
1182 for (defs) |*def| {
1183 // Original author of this next line had elf.SHN_UNDEF
1184 // here which does not make sense given that this field
1185 // is elf.VER_NDX
1186 if (def.ndx != .LOCAL)
1187 def.ndx = @enumFromInt(sections_update[src.sh_info].remap_idx);
1188 }
1182 for (defs) |*def| switch (def.ndx) {
1183 .LOCAL, .GLOBAL => {},
1184 else => def.ndx = @enumFromInt(sections_update[src.sh_info].remap_idx),
1185 };
11891186
11901187 break :dst_data data;
11911188 },