authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-10-08 16:22:23+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-09 12:38:53-07:00
log73c3b9b8ab056c3bcbde3a7a9b893b8814553c45
tree40a51c492fd46afd0e7514066beea87c7eb7f774
parente9d819a29e928d1f9069e12609806dacb558bb3f

elf: revert growing atoms in Dwarf.resize for standard alloc


1 files changed, 1 insertions(+), 11 deletions(-)

src/link/Dwarf.zig+1-11
......@@ -389,20 +389,10 @@ pub const Section = struct {
389389 if (dwarf.bin_file.cast(.elf)) |elf_file| {
390390 const zo = elf_file.zigObjectPtr().?;
391391 const atom = zo.symbol(sec.index).atom(elf_file).?;
392 const old_size = atom.size;
393392 atom.size = len;
394393 atom.alignment = sec.alignment;
395394 sec.len = len;
396 if (old_size > 0) {
397 if (!atom.alignment.check(@intCast(atom.value)) or atom.size > atom.fileCapacity(elf_file)) {
398 try zo.allocateAtom(atom, false, elf_file);
399 } else {
400 const shdr = &elf_file.sections.items(.shdr)[atom.output_section_index];
401 shdr.sh_size = (shdr.sh_size - old_size) + atom.size;
402 }
403 } else {
404 try zo.allocateAtom(atom, false, elf_file);
405 }
395 try zo.allocateAtom(atom, false, elf_file);
406396 } else if (dwarf.bin_file.cast(.macho)) |macho_file| {
407397 const header = if (macho_file.d_sym) |*d_sym| header: {
408398 try d_sym.growSection(@intCast(sec.index), len, true, macho_file);