authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-08-07 10:16:49+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-08-07 10:21:03+02:00
logb058545970efb6f533f9930d23af2a6d0c6ce9c3
tree08de418fbe5fc6ea8bfb86e6d03da17576606b17
parent90c4037819b44f285e78dafac5a0196abb36b86a

elf: remove stale code


3 files changed, 0 insertions(+), 32 deletions(-)

src/link/Elf/Object.zig-8
...@@ -630,12 +630,6 @@ pub fn claimUnresolvedObject(self: *Object, elf_file: *Elf) void {...@@ -630,12 +630,6 @@ pub fn claimUnresolvedObject(self: *Object, elf_file: *Elf) void {
630 if (esym.st_shndx != elf.SHN_UNDEF) continue;630 if (esym.st_shndx != elf.SHN_UNDEF) continue;
631 if (elf_file.symbol(self.resolveSymbol(esym_index, elf_file)) != null) continue;631 if (elf_file.symbol(self.resolveSymbol(esym_index, elf_file)) != null) continue;
632632
633 // TODO: audit this
634 // const global = elf_file.symbol(index);
635 // if (global.file(elf_file)) |file| {
636 // if (global.elfSym(elf_file).st_shndx != elf.SHN_UNDEF or file.index() <= self.index) continue;
637 // }
638
639 sym.value = 0;633 sym.value = 0;
640 sym.ref = .{ .index = 0, .file = 0 };634 sym.ref = .{ .index = 0, .file = 0 };
641 sym.esym_index = esym_index;635 sym.esym_index = esym_index;
...@@ -849,8 +843,6 @@ pub fn resolveMergeSubsections(self: *Object, elf_file: *Elf) !void {...@@ -849,8 +843,6 @@ pub fn resolveMergeSubsections(self: *Object, elf_file: *Elf) !void {
849843
850 for (self.symtab.items, 0..) |*esym, idx| {844 for (self.symtab.items, 0..) |*esym, idx| {
851 const sym = &self.symbols.items[idx];845 const sym = &self.symbols.items[idx];
852 // TODO: do we need ref here?
853
854 if (esym.st_shndx == elf.SHN_COMMON or esym.st_shndx == elf.SHN_UNDEF or esym.st_shndx == elf.SHN_ABS) continue;846 if (esym.st_shndx == elf.SHN_COMMON or esym.st_shndx == elf.SHN_UNDEF or esym.st_shndx == elf.SHN_ABS) continue;
855847
856 const imsec_index = self.input_merge_sections_indexes.items[esym.st_shndx];848 const imsec_index = self.input_merge_sections_indexes.items[esym.st_shndx];
src/link/Elf/ZigObject.zig-12
...@@ -410,12 +410,6 @@ pub fn claimUnresolvedObject(self: ZigObject, elf_file: *Elf) void {...@@ -410,12 +410,6 @@ pub fn claimUnresolvedObject(self: ZigObject, elf_file: *Elf) void {
410 if (esym.st_shndx != elf.SHN_UNDEF) continue;410 if (esym.st_shndx != elf.SHN_UNDEF) continue;
411 if (elf_file.symbol(self.resolveSymbol(@intCast(i | global_symbol_bit), elf_file)) != null) continue;411 if (elf_file.symbol(self.resolveSymbol(@intCast(i | global_symbol_bit), elf_file)) != null) continue;
412412
413 // TODO: audit this
414 // const global = elf_file.symbol(index);
415 // if (global.file(elf_file)) |file| {
416 // if (global.elfSym(elf_file).st_shndx != elf.SHN_UNDEF or file.index() <= self.index) continue;
417 // }
418
419 global.value = 0;413 global.value = 0;
420 global.ref = .{ .index = 0, .file = 0 };414 global.ref = .{ .index = 0, .file = 0 };
421 global.esym_index = @intCast(index);415 global.esym_index = @intCast(index);
...@@ -1512,12 +1506,6 @@ pub fn deleteExport(...@@ -1512,12 +1506,6 @@ pub fn deleteExport(
1512 log.debug("deleting export '{s}'", .{exp_name});1506 log.debug("deleting export '{s}'", .{exp_name});
1513 const esym = &self.symtab.items(.elf_sym)[esym_index.*];1507 const esym = &self.symtab.items(.elf_sym)[esym_index.*];
1514 _ = self.globals_lookup.remove(esym.st_name);1508 _ = self.globals_lookup.remove(esym.st_name);
1515 // const sym_index = elf_file.resolver.get(esym.st_name).?;
1516 // const sym = elf_file.symbol(sym_index);
1517 // if (sym.file_index == self.index) {
1518 // _ = elf_file.resolver.swapRemove(esym.st_name);
1519 // sym.* = .{};
1520 // }
1521 esym.* = Elf.null_sym;1509 esym.* = Elf.null_sym;
1522 self.symtab.items(.shndx)[esym_index.*] = elf.SHN_UNDEF;1510 self.symtab.items(.shndx)[esym_index.*] = elf.SHN_UNDEF;
1523}1511}
src/link/Elf/file.zig-12
...@@ -67,18 +67,6 @@ pub const File = union(enum) {...@@ -67,18 +67,6 @@ pub const File = union(enum) {
67 };67 };
68 }68 }
6969
70 pub fn resetGlobals(file: File, elf_file: *Elf) void {
71 for (file.globals()) |global_index| {
72 const global = elf_file.symbol(global_index);
73 const name_offset = global.name_offset;
74 const extra_index = global.extra_index;
75 global.* = .{};
76 global.name_offset = name_offset;
77 global.flags.global = true;
78 global.extra_index = extra_index;
79 }
80 }
81
82 pub fn setAlive(file: File) void {70 pub fn setAlive(file: File) void {
83 switch (file) {71 switch (file) {
84 .zig_object, .linker_defined => {},72 .zig_object, .linker_defined => {},