elf: remove stale code

This commit is contained in:
Jakub Konka 2024-08-07 10:16:49 +02:00
parent 90c4037819
commit b058545970
3 changed files with 0 additions and 32 deletions

View File

@ -630,12 +630,6 @@ pub fn claimUnresolvedObject(self: *Object, elf_file: *Elf) void {
if (esym.st_shndx != elf.SHN_UNDEF) continue;
if (elf_file.symbol(self.resolveSymbol(esym_index, elf_file)) != null) continue;
// TODO: audit this
// const global = elf_file.symbol(index);
// if (global.file(elf_file)) |file| {
// if (global.elfSym(elf_file).st_shndx != elf.SHN_UNDEF or file.index() <= self.index) continue;
// }
sym.value = 0;
sym.ref = .{ .index = 0, .file = 0 };
sym.esym_index = esym_index;
@ -849,8 +843,6 @@ pub fn resolveMergeSubsections(self: *Object, elf_file: *Elf) !void {
for (self.symtab.items, 0..) |*esym, idx| {
const sym = &self.symbols.items[idx];
// TODO: do we need ref here?
if (esym.st_shndx == elf.SHN_COMMON or esym.st_shndx == elf.SHN_UNDEF or esym.st_shndx == elf.SHN_ABS) continue;
const imsec_index = self.input_merge_sections_indexes.items[esym.st_shndx];

View File

@ -410,12 +410,6 @@ pub fn claimUnresolvedObject(self: ZigObject, elf_file: *Elf) void {
if (esym.st_shndx != elf.SHN_UNDEF) continue;
if (elf_file.symbol(self.resolveSymbol(@intCast(i | global_symbol_bit), elf_file)) != null) continue;
// TODO: audit this
// const global = elf_file.symbol(index);
// if (global.file(elf_file)) |file| {
// if (global.elfSym(elf_file).st_shndx != elf.SHN_UNDEF or file.index() <= self.index) continue;
// }
global.value = 0;
global.ref = .{ .index = 0, .file = 0 };
global.esym_index = @intCast(index);
@ -1512,12 +1506,6 @@ pub fn deleteExport(
log.debug("deleting export '{s}'", .{exp_name});
const esym = &self.symtab.items(.elf_sym)[esym_index.*];
_ = self.globals_lookup.remove(esym.st_name);
// const sym_index = elf_file.resolver.get(esym.st_name).?;
// const sym = elf_file.symbol(sym_index);
// if (sym.file_index == self.index) {
// _ = elf_file.resolver.swapRemove(esym.st_name);
// sym.* = .{};
// }
esym.* = Elf.null_sym;
self.symtab.items(.shndx)[esym_index.*] = elf.SHN_UNDEF;
}

View File

@ -67,18 +67,6 @@ pub const File = union(enum) {
};
}
pub fn resetGlobals(file: File, elf_file: *Elf) void {
for (file.globals()) |global_index| {
const global = elf_file.symbol(global_index);
const name_offset = global.name_offset;
const extra_index = global.extra_index;
global.* = .{};
global.name_offset = name_offset;
global.flags.global = true;
global.extra_index = extra_index;
}
}
pub fn setAlive(file: File) void {
switch (file) {
.zig_object, .linker_defined => {},