Skip to content

Commit

Permalink
objcopy: check both global and local when remapping
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrk authored and richerfu committed Oct 28, 2024
1 parent 9c7e829 commit 1ffc99a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/compiler/objcopy.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1179,13 +1179,10 @@ fn ElfFile(comptime is_64: bool) type {
@memcpy(data, src_data);

const defs = @as([*]elf.Verdef, @ptrCast(data))[0 .. @as(usize, @intCast(src.sh_size)) / @sizeOf(elf.Verdef)];
for (defs) |*def| {
// Original author of this next line had elf.SHN_UNDEF
// here which does not make sense given that this field
// is elf.VER_NDX
if (def.ndx != .LOCAL)
def.ndx = @enumFromInt(sections_update[src.sh_info].remap_idx);
}
for (defs) |*def| switch (def.ndx) {
.LOCAL, .GLOBAL => {},
else => def.ndx = @enumFromInt(sections_update[src.sh_info].remap_idx),
};

break :dst_data data;
},
Expand Down

0 comments on commit 1ffc99a

Please sign in to comment.