aboutsummaryrefslogtreecommitdiff
path: root/src/link/Elf/Object.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-10-10 17:35:04 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-10-11 10:33:54 -0700
commit2c4e05eda7c3b6e27e83f85ca0a7c501c15775e7 (patch)
treead351533e5121dff472437c6af922e8c7edada53 /src/link/Elf/Object.zig
parentc3148988a3e1ccbe351b8d51359490eb8258c18f (diff)
downloadzig-2c4e05eda7c3b6e27e83f85ca0a7c501c15775e7.tar.gz
zig-2c4e05eda7c3b6e27e83f85ca0a7c501c15775e7.zip
link.Elf: group section indexes
so they cannot be forgotten when updating them after sorting them.
Diffstat (limited to 'src/link/Elf/Object.zig')
-rw-r--r--src/link/Elf/Object.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig
index 23216020a6..03172efb38 100644
--- a/src/link/Elf/Object.zig
+++ b/src/link/Elf/Object.zig
@@ -927,7 +927,7 @@ pub fn initRelaSections(self: *Object, elf_file: *Elf) !void {
for (self.atoms_indexes.items) |atom_index| {
const atom_ptr = self.atom(atom_index) orelse continue;
if (!atom_ptr.alive) continue;
- if (atom_ptr.output_section_index == elf_file.eh_frame_section_index) continue;
+ if (atom_ptr.output_section_index == elf_file.section_indexes.eh_frame) continue;
const shndx = atom_ptr.relocsShndx() orelse continue;
const shdr = self.shdrs.items[shndx];
const out_shndx = try elf_file.initOutputSection(.{
@@ -947,7 +947,7 @@ pub fn addAtomsToRelaSections(self: *Object, elf_file: *Elf) !void {
for (self.atoms_indexes.items) |atom_index| {
const atom_ptr = self.atom(atom_index) orelse continue;
if (!atom_ptr.alive) continue;
- if (atom_ptr.output_section_index == elf_file.eh_frame_section_index) continue;
+ if (atom_ptr.output_section_index == elf_file.section_indexes.eh_frame) continue;
const shndx = blk: {
const shndx = atom_ptr.relocsShndx() orelse continue;
const shdr = self.shdrs.items[shndx];
@@ -960,7 +960,7 @@ pub fn addAtomsToRelaSections(self: *Object, elf_file: *Elf) !void {
const slice = elf_file.sections.slice();
const shdr = &slice.items(.shdr)[shndx];
shdr.sh_info = atom_ptr.output_section_index;
- shdr.sh_link = elf_file.symtab_section_index.?;
+ shdr.sh_link = elf_file.section_indexes.symtab.?;
const gpa = elf_file.base.comp.gpa;
const atom_list = &elf_file.sections.items(.atom_list)[shndx];
try atom_list.append(gpa, .{ .index = atom_index, .file = self.index });