authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-05-24 23:06:27+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-05-24 23:06:27+02:00
log42c058575e2be291e351fe7dd4fdd6f5e4b9b703
tree231eda19a406df41bf4022973cca0943b6e86729
parent19f41d390f6761885c836be9c1a57efc8e81a606

link/macho: fix 32bit build


1 files changed, 5 insertions(+), 4 deletions(-)

src/link/MachO/dwarf.zig+5-4
...@@ -119,7 +119,8 @@ pub const InfoReader = struct {...@@ -119,7 +119,8 @@ pub const InfoReader = struct {
119 switch (form) {119 switch (form) {
120 dwarf.FORM.strp => {120 dwarf.FORM.strp => {
121 const off = try p.readOffset(cuh.format);121 const off = try p.readOffset(cuh.format);
122 return mem.sliceTo(@as([*:0]const u8, @ptrCast(p.strtab.ptr + off)), 0);122 const off_u = math.cast(usize, off) orelse return error.Overflow;
123 return mem.sliceTo(@as([*:0]const u8, @ptrCast(p.strtab.ptr + off_u)), 0);
123 },124 },
124 dwarf.FORM.string => {125 dwarf.FORM.string => {
125 const start = p.pos;126 const start = p.pos;
...@@ -163,7 +164,7 @@ pub const InfoReader = struct {...@@ -163,7 +164,7 @@ pub const InfoReader = struct {
163 var stream = std.io.fixedBufferStream(p.bytes[p.pos..]);164 var stream = std.io.fixedBufferStream(p.bytes[p.pos..]);
164 var creader = std.io.countingReader(stream.reader());165 var creader = std.io.countingReader(stream.reader());
165 const value: Type = try leb.readULEB128(Type, creader.reader());166 const value: Type = try leb.readULEB128(Type, creader.reader());
166 p.pos += creader.bytes_read;167 p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow;
167 return value;168 return value;
168 }169 }
169170
...@@ -171,7 +172,7 @@ pub const InfoReader = struct {...@@ -171,7 +172,7 @@ pub const InfoReader = struct {
171 var stream = std.io.fixedBufferStream(p.bytes[p.pos..]);172 var stream = std.io.fixedBufferStream(p.bytes[p.pos..]);
172 var creader = std.io.countingReader(stream.reader());173 var creader = std.io.countingReader(stream.reader());
173 const value: Type = try leb.readILEB128(Type, creader.reader());174 const value: Type = try leb.readILEB128(Type, creader.reader());
174 p.pos += creader.bytes_read;175 p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow;
175 return value;176 return value;
176 }177 }
177178
...@@ -226,7 +227,7 @@ pub const AbbrevReader = struct {...@@ -226,7 +227,7 @@ pub const AbbrevReader = struct {
226 var stream = std.io.fixedBufferStream(p.bytes[p.pos..]);227 var stream = std.io.fixedBufferStream(p.bytes[p.pos..]);
227 var creader = std.io.countingReader(stream.reader());228 var creader = std.io.countingReader(stream.reader());
228 const value: Type = try leb.readULEB128(Type, creader.reader());229 const value: Type = try leb.readULEB128(Type, creader.reader());
229 p.pos += creader.bytes_read;230 p.pos += math.cast(usize, creader.bytes_read) orelse return error.Overflow;
230 return value;231 return value;
231 }232 }
232233