Skip to content

Commit 81af4f3

Browse files
committed
link: update some dwarf code to non deprecated API
1 parent 3fff84a commit 81af4f3

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/link/Dwarf.zig

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ const DebugInfo = struct {
142142
&abbrev_code_buf,
143143
debug_info.section.off(dwarf) + unit_ptr.off + unit_ptr.header_len + entry_ptr.off,
144144
) != abbrev_code_buf.len) return error.InputOutput;
145-
var abbrev_code_fbs = std.io.fixedBufferStream(&abbrev_code_buf);
146-
return @enumFromInt(std.leb.readUleb128(@typeInfo(AbbrevCode).@"enum".tag_type, abbrev_code_fbs.reader()) catch unreachable);
145+
var abbrev_code_reader: std.Io.Reader = .fixed(&abbrev_code_buf);
146+
return @enumFromInt(abbrev_code_reader.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable);
147147
}
148148

149149
const trailer_bytes = 1 + 1;
@@ -6021,15 +6021,17 @@ fn sectionOffsetBytes(dwarf: *Dwarf) u32 {
60216021
}
60226022

60236023
fn uleb128Bytes(value: anytype) u32 {
6024-
var cw = std.io.countingWriter(std.io.null_writer);
6025-
try uleb128(cw.writer(), value);
6026-
return @intCast(cw.bytes_written);
6024+
var trash_buffer: [64]u8 = undefined;
6025+
var d: std.Io.Writer.Discarding = .init(&trash_buffer);
6026+
d.writer.writeUleb128(value) catch unreachable;
6027+
return @intCast(d.count + d.writer.end);
60276028
}
60286029

60296030
fn sleb128Bytes(value: anytype) u32 {
6030-
var cw = std.io.countingWriter(std.io.null_writer);
6031-
try sleb128(cw.writer(), value);
6032-
return @intCast(cw.bytes_written);
6031+
var trash_buffer: [64]u8 = undefined;
6032+
var d: std.Io.Writer.Discarding = .init(&trash_buffer);
6033+
d.writer.writeSleb128(value) catch unreachable;
6034+
return @intCast(d.count + d.writer.end);
60336035
}
60346036

60356037
/// overrides `-fno-incremental` for testing incremental debug info until `-fincremental` is functional

0 commit comments

Comments
 (0)