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