elf: simplify accessors to symbols, atoms, etc

This commit is contained in:
Jakub Konka
2023-09-04 11:23:19 +02:00
parent 009a349779
commit bc37c95e56
8 changed files with 118 additions and 150 deletions

View File

@@ -855,7 +855,7 @@ fn genDeclRef(
if (bin_file.cast(link.File.Elf)) |elf_file| {
const atom_index = try elf_file.getOrCreateAtomForDecl(decl_index);
const atom = elf_file.getAtom(atom_index);
const atom = elf_file.atom(atom_index);
_ = try atom.getOrCreateOffsetTableEntry(elf_file);
return GenResult.mcv(.{ .memory = atom.getOffsetTableAddress(elf_file) });
} else if (bin_file.cast(link.File.MachO)) |macho_file| {
@@ -892,7 +892,7 @@ fn genUnnamedConst(
return GenResult.fail(bin_file.allocator, src_loc, "lowering unnamed constant failed: {s}", .{@errorName(err)});
};
if (bin_file.cast(link.File.Elf)) |elf_file| {
return GenResult.mcv(.{ .memory = elf_file.getSymbol(local_sym_index).st_value });
return GenResult.mcv(.{ .memory = elf_file.symbol(local_sym_index).st_value });
} else if (bin_file.cast(link.File.MachO)) |_| {
return GenResult.mcv(.{ .load_direct = local_sym_index });
} else if (bin_file.cast(link.File.Coff)) |_| {