Commit 6a50a0f0ed

Jakub Konka <kubkon@jakubkonka.com>
2024-09-02 08:58:49
elf: update osec index for section chunks in objects
1 parent f87a725
Changed files (1)
src
link
src/link/Elf.zig
@@ -3411,6 +3411,7 @@ fn shdrRank(self: *Elf, shndx: u32) u8 {
                 return 0xf9;
             }
         },
+        elf.SHT_X86_64_UNWIND => return 0xf0,
 
         elf.SHT_NOBITS => return if (flags & elf.SHF_TLS != 0) 0xf5 else 0xf7,
         elf.SHT_SYMTAB => return 0xfa,
@@ -3503,6 +3504,12 @@ fn resetShdrIndexes(self: *Elf, backlinks: []const u32) void {
         }
     }
 
+    for (self.objects.items) |index| {
+        for (self.file(index).?.object.section_chunks.items) |*chunk| {
+            chunk.output_section_index = backlinks[chunk.output_section_index];
+        }
+    }
+
     for (self.comdat_group_sections.items) |*cg| {
         cg.shndx = backlinks[cg.shndx];
     }