aboutsummaryrefslogtreecommitdiff
path: root/src/link/Elf
diff options
context:
space:
mode:
Diffstat (limited to 'src/link/Elf')
-rw-r--r--src/link/Elf/Atom.zig12
-rw-r--r--src/link/Elf/synthetic_sections.zig4
2 files changed, 9 insertions, 7 deletions
diff --git a/src/link/Elf/Atom.zig b/src/link/Elf/Atom.zig
index 6c83350561..ead42917a1 100644
--- a/src/link/Elf/Atom.zig
+++ b/src/link/Elf/Atom.zig
@@ -79,9 +79,10 @@ pub fn freeRelocations(elf_file: *Elf, atom_index: Index) void {
}
pub fn allocate(self: *Atom, elf_file: *Elf) !void {
- const shdr = &elf_file.sections.items(.shdr)[self.output_section_index];
- const free_list = &elf_file.sections.items(.free_list)[self.output_section_index];
- const last_atom_index = &elf_file.sections.items(.last_atom_index)[self.output_section_index];
+ const shdr = &elf_file.shdrs.items[self.output_section_index];
+ const meta = elf_file.last_atom_and_free_list_table.getPtr(self.output_section_index).?;
+ const free_list = &meta.free_list;
+ const last_atom_index = &meta.last_atom_index;
const new_atom_ideal_capacity = Elf.padToIdeal(self.size);
const alignment = try std.math.powi(u64, 2, self.alignment);
@@ -208,7 +209,9 @@ pub fn free(self: *Atom, elf_file: *Elf) void {
const gpa = elf_file.base.allocator;
const shndx = self.output_section_index;
- const free_list = &elf_file.sections.items(.free_list)[shndx];
+ const meta = elf_file.last_atom_and_free_list_table.getPtr(shndx).?;
+ const free_list = &meta.free_list;
+ const last_atom_index = &meta.last_atom_index;
var already_have_free_list_node = false;
{
var i: usize = 0;
@@ -225,7 +228,6 @@ pub fn free(self: *Atom, elf_file: *Elf) void {
}
}
- const last_atom_index = &elf_file.sections.items(.last_atom_index)[shndx];
if (elf_file.atom(last_atom_index.*)) |last_atom| {
if (last_atom.atom_index == self.atom_index) {
if (elf_file.atom(self.prev_index)) |_| {
diff --git a/src/link/Elf/synthetic_sections.zig b/src/link/Elf/synthetic_sections.zig
index 00d3b41b61..f178f1370f 100644
--- a/src/link/Elf/synthetic_sections.zig
+++ b/src/link/Elf/synthetic_sections.zig
@@ -29,7 +29,7 @@ pub const GotSection = struct {
pub fn address(entry: Entry, elf_file: *Elf) u64 {
const ptr_bytes = @as(u64, elf_file.archPtrWidthBytes());
- const shdr = &elf_file.sections.items(.shdr)[elf_file.got_section_index.?];
+ const shdr = &elf_file.shdrs.items[elf_file.got_section_index.?];
return shdr.sh_addr + @as(u64, entry.cell_index) * ptr_bytes;
}
};
@@ -124,7 +124,7 @@ pub const GotSection = struct {
}
const endian = elf_file.base.options.target.cpu.arch.endian();
const entry = got.entries.items[index];
- const shdr = &elf_file.sections.items(.shdr)[elf_file.got_section_index.?];
+ const shdr = &elf_file.shdrs.items[elf_file.got_section_index.?];
const off = shdr.sh_offset + @as(u64, entry_size) * entry.cell_index;
const vaddr = shdr.sh_addr + @as(u64, entry_size) * entry.cell_index;
const value = elf_file.symbol(entry.symbol_index).value;