commit a53a8ab25ef5138a0d72af3011c4dcc51bfa0caf (tree)
parent 6d97185bc6aac388ee17df26674caf1a702c36f9
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date: Sat, 14 Dec 2024 23:19:29 -0500
Elf: fix shdr size getting out of sync with the actual size
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig
@@ -419,6 +419,7 @@ pub const Section = struct {
} else {
const shdr = &elf_file.sections.items(.shdr)[atom.output_section_index];
shdr.sh_offset += len;
+ shdr.sh_size -= len;
atom.value = 0;
}
atom.size -= len;
@@ -428,7 +429,7 @@ pub const Section = struct {
else
&macho_file.sections.items(.header)[sec.index];
header.offset += @intCast(len);
- header.size = sec.len;
+ header.size -= len;
}
}