| ... | @@ -81,7 +81,7 @@ pub fn resolveSymbols(self: *ZigModule, elf_file: *Elf) void { | ... | @@ -81,7 +81,7 @@ pub fn resolveSymbols(self: *ZigModule, elf_file: *Elf) void { |
| 81 | if (esym.st_shndx == elf.SHN_UNDEF) continue; | 81 | if (esym.st_shndx == elf.SHN_UNDEF) continue; |
| 82 | | 82 | |
| 83 | if (esym.st_shndx != elf.SHN_ABS and esym.st_shndx != elf.SHN_COMMON) { | 83 | if (esym.st_shndx != elf.SHN_ABS and esym.st_shndx != elf.SHN_COMMON) { |
| 84 | const atom_index = self.atoms.keys()[esym.st_shndx]; | 84 | const atom_index = esym.st_shndx; |
| 85 | const atom = elf_file.atom(atom_index) orelse continue; | 85 | const atom = elf_file.atom(atom_index) orelse continue; |
| 86 | if (!atom.alive) continue; | 86 | if (!atom.alive) continue; |
| 87 | } | 87 | } |
| ... | @@ -90,12 +90,17 @@ pub fn resolveSymbols(self: *ZigModule, elf_file: *Elf) void { | ... | @@ -90,12 +90,17 @@ pub fn resolveSymbols(self: *ZigModule, elf_file: *Elf) void { |
| 90 | if (self.asFile().symbolRank(esym, false) < global.symbolRank(elf_file)) { | 90 | if (self.asFile().symbolRank(esym, false) < global.symbolRank(elf_file)) { |
| 91 | const atom_index = switch (esym.st_shndx) { | 91 | const atom_index = switch (esym.st_shndx) { |
| 92 | elf.SHN_ABS, elf.SHN_COMMON => 0, | 92 | elf.SHN_ABS, elf.SHN_COMMON => 0, |
| 93 | else => self.atoms.keys()[esym.st_shndx], | 93 | else => esym.st_shndx, |
| 94 | }; | 94 | }; |
| | 95 | const output_section_index = if (elf_file.atom(atom_index)) |atom| |
| | 96 | atom.output_section_index |
| | 97 | else |
| | 98 | 0; |
| 95 | global.value = esym.st_value; | 99 | global.value = esym.st_value; |
| 96 | global.atom_index = atom_index; | 100 | global.atom_index = atom_index; |
| 97 | global.esym_index = esym_index; | 101 | global.esym_index = esym_index; |
| 98 | global.file_index = self.index; | 102 | global.file_index = self.index; |
| | 103 | global.output_section_index = output_section_index; |
| 99 | global.version_index = elf_file.default_sym_version; | 104 | global.version_index = elf_file.default_sym_version; |
| 100 | if (esym.st_bind() == elf.STB_WEAK) global.flags.weak = true; | 105 | if (esym.st_bind() == elf.STB_WEAK) global.flags.weak = true; |
| 101 | } | 106 | } |