aboutsummaryrefslogtreecommitdiff
path: root/src/link/Dwarf.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-10-16 12:38:40 +0200
committerJakub Konka <kubkon@jakubkonka.com>2023-10-16 19:33:06 +0200
commitee1c3c70580bc8d0259a495cf67c3090196983b5 (patch)
tree3810b12e3b66754fee915f0dfd3293e183eede35 /src/link/Dwarf.zig
parentb0e2c6323bfa8f5991546cb96122a29a599e0365 (diff)
downloadzig-ee1c3c70580bc8d0259a495cf67c3090196983b5.tar.gz
zig-ee1c3c70580bc8d0259a495cf67c3090196983b5.zip
elf: correctly copy and write out debug sections
Diffstat (limited to 'src/link/Dwarf.zig')
-rw-r--r--src/link/Dwarf.zig5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig
index ffe078f831..a8f4125644 100644
--- a/src/link/Dwarf.zig
+++ b/src/link/Dwarf.zig
@@ -1851,8 +1851,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, module: *Module, low_pc: u64, high_pc: u
// not including the initial length itself.
// We have to come back and write it later after we know the size.
const after_init_len = di_buf.items.len + init_len_size;
- // +1 for the final 0 that ends the compilation unit children.
- const dbg_info_end = self.getDebugInfoEnd().? + 1;
+ const dbg_info_end = self.getDebugInfoEnd().?;
const init_len = dbg_info_end - after_init_len;
if (self.bin_file.tag == .macho) {
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), @as(u32, @intCast(init_len)));
@@ -2501,7 +2500,7 @@ fn getDebugInfoOff(self: Dwarf) ?u32 {
fn getDebugInfoEnd(self: Dwarf) ?u32 {
const last_index = self.di_atom_last_index orelse return null;
const last = self.getAtom(.di_atom, last_index);
- return last.off + last.len;
+ return last.off + last.len + 1;
}
fn getDebugLineProgramOff(self: Dwarf) ?u32 {