Commit d23472747e

Jakub Konka <kubkon@jakubkonka.com>
2023-03-03 18:53:47
elf: fully zero out symbol when appending to freelist
1 parent f6eeb6c
Changed files (1)
src
link
src/link/Elf.zig
@@ -2097,9 +2097,16 @@ fn freeAtom(self: *Elf, atom_index: Atom.Index) void {
     // Appending to free lists is allowed to fail because the free lists are heuristics based anyway.
     const local_sym_index = atom.getSymbolIndex().?;
 
+    log.debug("adding %{d} to local symbols free list", .{local_sym_index});
     self.local_symbol_free_list.append(gpa, local_sym_index) catch {};
-    self.local_symbols.items[local_sym_index].st_info = 0;
-    self.local_symbols.items[local_sym_index].st_shndx = 0;
+    self.local_symbols.items[local_sym_index] = .{
+        .st_name = 0,
+        .st_info = 0,
+        .st_other = 0,
+        .st_shndx = 0,
+        .st_value = 0,
+        .st_size = 0,
+    };
     _ = self.atom_by_index_table.remove(local_sym_index);
     self.getAtomPtr(atom_index).local_sym_index = 0;