| ... | @@ -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); |