authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-29 17:02:44-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-31 22:10:11-07:00
log81af4f3efc2e40db757426b9c870157d10ebec5a
treedec66da82a542da2898f7a8e34a0c1ee79b5f35c
parent3fff84a4a4fb8f9926436313d4e44773b8afc4eb

link: update some dwarf code to non deprecated API


1 files changed, 10 insertions(+), 8 deletions(-)

src/link/Dwarf.zig+10-8
...@@ -142,8 +142,8 @@ const DebugInfo = struct {...@@ -142,8 +142,8 @@ const DebugInfo = struct {
142 &abbrev_code_buf,142 &abbrev_code_buf,
143 debug_info.section.off(dwarf) + unit_ptr.off + unit_ptr.header_len + entry_ptr.off,143 debug_info.section.off(dwarf) + unit_ptr.off + unit_ptr.header_len + entry_ptr.off,
144 ) != abbrev_code_buf.len) return error.InputOutput;144 ) != abbrev_code_buf.len) return error.InputOutput;
145 var abbrev_code_fbs = std.io.fixedBufferStream(&abbrev_code_buf);145 var abbrev_code_reader: std.Io.Reader = .fixed(&abbrev_code_buf);
146 return @enumFromInt(std.leb.readUleb128(@typeInfo(AbbrevCode).@"enum".tag_type, abbrev_code_fbs.reader()) catch unreachable);146 return @enumFromInt(abbrev_code_reader.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable);
147 }147 }
148148
149 const trailer_bytes = 1 + 1;149 const trailer_bytes = 1 + 1;
...@@ -6021,15 +6021,17 @@ fn sectionOffsetBytes(dwarf: *Dwarf) u32 {...@@ -6021,15 +6021,17 @@ fn sectionOffsetBytes(dwarf: *Dwarf) u32 {
6021}6021}
60226022
6023fn uleb128Bytes(value: anytype) u32 {6023fn uleb128Bytes(value: anytype) u32 {
6024 var cw = std.io.countingWriter(std.io.null_writer);6024 var trash_buffer: [64]u8 = undefined;
6025 try uleb128(cw.writer(), value);6025 var d: std.Io.Writer.Discarding = .init(&trash_buffer);
6026 return @intCast(cw.bytes_written);6026 d.writer.writeUleb128(value) catch unreachable;
6027 return @intCast(d.count + d.writer.end);
6027}6028}
60286029
6029fn sleb128Bytes(value: anytype) u32 {6030fn sleb128Bytes(value: anytype) u32 {
6030 var cw = std.io.countingWriter(std.io.null_writer);6031 var trash_buffer: [64]u8 = undefined;
6031 try sleb128(cw.writer(), value);6032 var d: std.Io.Writer.Discarding = .init(&trash_buffer);
6032 return @intCast(cw.bytes_written);6033 d.writer.writeSleb128(value) catch unreachable;
6034 return @intCast(d.count + d.writer.end);
6033}6035}
60346036
6035/// overrides `-fno-incremental` for testing incremental debug info until `-fincremental` is functional6037/// overrides `-fno-incremental` for testing incremental debug info until `-fincremental` is functional