authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-14 23:19:29-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-14 23:20:15-05:00
loga53a8ab25ef5138a0d72af3011c4dcc51bfa0caf
tree43e309e9ba52abdccacced5e1e01d9a4f6d02bd7
parent6d97185bc6aac388ee17df26674caf1a702c36f9

Elf: fix shdr size getting out of sync with the actual size


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

src/link/Dwarf.zig+2-1
...@@ -419,6 +419,7 @@ pub const Section = struct {...@@ -419,6 +419,7 @@ pub const Section = struct {
419 } else {419 } else {
420 const shdr = &elf_file.sections.items(.shdr)[atom.output_section_index];420 const shdr = &elf_file.sections.items(.shdr)[atom.output_section_index];
421 shdr.sh_offset += len;421 shdr.sh_offset += len;
422 shdr.sh_size -= len;
422 atom.value = 0;423 atom.value = 0;
423 }424 }
424 atom.size -= len;425 atom.size -= len;
...@@ -428,7 +429,7 @@ pub const Section = struct {...@@ -428,7 +429,7 @@ pub const Section = struct {
428 else429 else
429 &macho_file.sections.items(.header)[sec.index];430 &macho_file.sections.items(.header)[sec.index];
430 header.offset += @intCast(len);431 header.offset += @intCast(len);
431 header.size = sec.len;432 header.size -= len;
432 }433 }
433 }434 }
434435