| ... | ... | @@ -3367,6 +3367,28 @@ fn resetShdrIndexes(self: *Elf, backlinks: []const u32) void { |
| 3367 | 3367 | } |
| 3368 | 3368 | } |
| 3369 | 3369 | |
| 3370 | for (self.merge_sections.items) |*msec| { |
| 3371 | msec.output_section_index = backlinks[msec.output_section_index]; |
| 3372 | } |
| 3373 | |
| 3374 | for (self.sections.items(.shdr)) |*shdr| { |
| 3375 | if (shdr.sh_type != elf.SHT_RELA) continue; |
| 3376 | shdr.sh_link = backlinks[shdr.sh_link]; |
| 3377 | shdr.sh_info = backlinks[shdr.sh_info]; |
| 3378 | } |
| 3379 | |
| 3380 | if (self.zigObjectPtr()) |zo| { |
| 3381 | for (zo.atoms_indexes.items) |atom_index| { |
| 3382 | const atom_ptr = zo.atom(atom_index) orelse continue; |
| 3383 | atom_ptr.output_section_index = backlinks[atom_ptr.output_section_index]; |
| 3384 | } |
| 3385 | if (zo.dwarf) |*dwarf| dwarf.reloadSectionMetadata(); |
| 3386 | } |
| 3387 | |
| 3388 | for (self.comdat_group_sections.items) |*cg| { |
| 3389 | cg.shndx = backlinks[cg.shndx]; |
| 3390 | } |
| 3391 | |
| 3370 | 3392 | if (self.symtab_section_index) |index| { |
| 3371 | 3393 | const shdr = &self.sections.items(.shdr)[index]; |
| 3372 | 3394 | shdr.sh_link = self.strtab_section_index.?; |
| ... | ... | @@ -3418,28 +3440,6 @@ fn resetShdrIndexes(self: *Elf, backlinks: []const u32) void { |
| 3418 | 3440 | shdr.sh_link = self.symtab_section_index.?; |
| 3419 | 3441 | shdr.sh_info = self.eh_frame_section_index.?; |
| 3420 | 3442 | } |
| 3421 | | |
| 3422 | | for (self.merge_sections.items) |*msec| { |
| 3423 | | msec.output_section_index = backlinks[msec.output_section_index]; |
| 3424 | | } |
| 3425 | | |
| 3426 | | for (self.sections.items(.shdr)) |*shdr| { |
| 3427 | | if (shdr.sh_type != elf.SHT_RELA) continue; |
| 3428 | | shdr.sh_link = backlinks[shdr.sh_link]; |
| 3429 | | shdr.sh_info = backlinks[shdr.sh_info]; |
| 3430 | | } |
| 3431 | | |
| 3432 | | if (self.zigObjectPtr()) |zo| { |
| 3433 | | for (zo.atoms_indexes.items) |atom_index| { |
| 3434 | | const atom_ptr = zo.atom(atom_index) orelse continue; |
| 3435 | | atom_ptr.output_section_index = backlinks[atom_ptr.output_section_index]; |
| 3436 | | } |
| 3437 | | if (zo.dwarf) |*dwarf| dwarf.reloadSectionMetadata(); |
| 3438 | | } |
| 3439 | | |
| 3440 | | for (self.comdat_group_sections.items) |*cg| { |
| 3441 | | cg.shndx = backlinks[cg.shndx]; |
| 3442 | | } |
| 3443 | 3443 | } |
| 3444 | 3444 | |
| 3445 | 3445 | fn updateSectionSizes(self: *Elf) !void { |