authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-08-06 08:51:06+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-08-07 10:21:02+02:00
log835f1fc03f795663bfd98a768f132bf99168d40f
tree7b475ca0e79e227fe2c64505d928b671bc35072e
parent0a198789f14f56dc55e6006e243b36402e3c20fc

elf: fix off-by-one when referring to resolved table directly


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

src/link/Elf/Object.zig+2-2
...@@ -1119,7 +1119,7 @@ pub fn updateSymtabSize(self: *Object, elf_file: *Elf) void {...@@ -1119,7 +1119,7 @@ pub fn updateSymtabSize(self: *Object, elf_file: *Elf) void {
1119 }1119 }
11201120
1121 for (self.globals(), self.symbols_resolver.items) |*global, resolv| {1121 for (self.globals(), self.symbols_resolver.items) |*global, resolv| {
1122 const ref = elf_file.resolver.values.items[resolv];1122 const ref = elf_file.resolver.values.items[resolv - 1];
1123 const ref_sym = elf_file.symbol(ref) orelse continue;1123 const ref_sym = elf_file.symbol(ref) orelse continue;
1124 if (ref_sym.file(elf_file).?.index() != self.index) continue;1124 if (ref_sym.file(elf_file).?.index() != self.index) continue;
1125 if (!isAlive(global, elf_file)) continue;1125 if (!isAlive(global, elf_file)) continue;
...@@ -1146,7 +1146,7 @@ pub fn writeSymtab(self: *Object, elf_file: *Elf) void {...@@ -1146,7 +1146,7 @@ pub fn writeSymtab(self: *Object, elf_file: *Elf) void {
1146 }1146 }
11471147
1148 for (self.globals(), self.symbols_resolver.items) |global, resolv| {1148 for (self.globals(), self.symbols_resolver.items) |global, resolv| {
1149 const ref = elf_file.resolver.values.items[resolv];1149 const ref = elf_file.resolver.values.items[resolv - 1];
1150 const ref_sym = elf_file.symbol(ref) orelse continue;1150 const ref_sym = elf_file.symbol(ref) orelse continue;
1151 if (ref_sym.file(elf_file).?.index() != self.index) continue;1151 if (ref_sym.file(elf_file).?.index() != self.index) continue;
1152 const idx = global.outputSymtabIndex(elf_file) orelse continue;1152 const idx = global.outputSymtabIndex(elf_file) orelse continue;