mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 16:45:27 +00:00
elf: remove stale code
This commit is contained in:
parent
90c4037819
commit
b058545970
@ -630,12 +630,6 @@ pub fn claimUnresolvedObject(self: *Object, elf_file: *Elf) void {
|
|||||||
if (esym.st_shndx != elf.SHN_UNDEF) continue;
|
if (esym.st_shndx != elf.SHN_UNDEF) continue;
|
||||||
if (elf_file.symbol(self.resolveSymbol(esym_index, elf_file)) != null) 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.value = 0;
|
||||||
sym.ref = .{ .index = 0, .file = 0 };
|
sym.ref = .{ .index = 0, .file = 0 };
|
||||||
sym.esym_index = esym_index;
|
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| {
|
for (self.symtab.items, 0..) |*esym, idx| {
|
||||||
const sym = &self.symbols.items[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;
|
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];
|
const imsec_index = self.input_merge_sections_indexes.items[esym.st_shndx];
|
||||||
|
@ -410,12 +410,6 @@ pub fn claimUnresolvedObject(self: ZigObject, elf_file: *Elf) void {
|
|||||||
if (esym.st_shndx != elf.SHN_UNDEF) continue;
|
if (esym.st_shndx != elf.SHN_UNDEF) continue;
|
||||||
if (elf_file.symbol(self.resolveSymbol(@intCast(i | global_symbol_bit), elf_file)) != null) 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.value = 0;
|
||||||
global.ref = .{ .index = 0, .file = 0 };
|
global.ref = .{ .index = 0, .file = 0 };
|
||||||
global.esym_index = @intCast(index);
|
global.esym_index = @intCast(index);
|
||||||
@ -1512,12 +1506,6 @@ pub fn deleteExport(
|
|||||||
log.debug("deleting export '{s}'", .{exp_name});
|
log.debug("deleting export '{s}'", .{exp_name});
|
||||||
const esym = &self.symtab.items(.elf_sym)[esym_index.*];
|
const esym = &self.symtab.items(.elf_sym)[esym_index.*];
|
||||||
_ = self.globals_lookup.remove(esym.st_name);
|
_ = 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;
|
esym.* = Elf.null_sym;
|
||||||
self.symtab.items(.shndx)[esym_index.*] = elf.SHN_UNDEF;
|
self.symtab.items(.shndx)[esym_index.*] = elf.SHN_UNDEF;
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
pub fn setAlive(file: File) void {
|
||||||
switch (file) {
|
switch (file) {
|
||||||
.zig_object, .linker_defined => {},
|
.zig_object, .linker_defined => {},
|
||||||
|
Loading…
Reference in New Issue
Block a user