elf: handle SHN_UNDEF explicitly in ZigObject.resolveSymbols

This commit is contained in:
Jakub Konka 2024-08-07 06:59:41 +02:00
parent 02f38d7749
commit 668fd7aca6

View File

@ -347,7 +347,7 @@ pub fn resolveSymbols(self: *ZigObject, elf_file: *Elf) !void {
const global = &self.symbols.items[index];
const esym = global.elfSym(elf_file);
const shndx = self.symtab.items(.shndx)[global.esym_index];
if (esym.st_shndx != elf.SHN_ABS and esym.st_shndx != elf.SHN_COMMON) {
if (esym.st_shndx != elf.SHN_ABS and esym.st_shndx != elf.SHN_COMMON and esym.st_shndx != elf.SHN_UNDEF) {
assert(esym.st_shndx == SHN_ATOM);
const atom_ptr = self.atom(shndx) orelse continue;
if (!atom_ptr.alive) continue;