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 {...@@ -389,20 +389,10 @@ pub const Section = struct {
389 if (dwarf.bin_file.cast(.elf)) |elf_file| {389 if (dwarf.bin_file.cast(.elf)) |elf_file| {
390 const zo = elf_file.zigObjectPtr().?;390 const zo = elf_file.zigObjectPtr().?;
391 const atom = zo.symbol(sec.index).atom(elf_file).?;391 const atom = zo.symbol(sec.index).atom(elf_file).?;
392 const old_size = atom.size;
393 atom.size = len;392 atom.size = len;
394 atom.alignment = sec.alignment;393 atom.alignment = sec.alignment;
395 sec.len = len;394 sec.len = len;
396 if (old_size > 0) {395 try zo.allocateAtom(atom, false, elf_file);
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 }
406 } else if (dwarf.bin_file.cast(.macho)) |macho_file| {396 } else if (dwarf.bin_file.cast(.macho)) |macho_file| {
407 const header = if (macho_file.d_sym) |*d_sym| header: {397 const header = if (macho_file.d_sym) |*d_sym| header: {
408 try d_sym.growSection(@intCast(sec.index), len, true, macho_file);398 try d_sym.growSection(@intCast(sec.index), len, true, macho_file);