| author | |
| committer | |
| log | d1f60a63bdd7bd838c210a888dfe23c9ea9f2669 |
| tree | 76f2bf28518fe9ec56cd070857ae913f0eba4112 |
| parent | a9dd8d75431357a59238da3fd949aa1f11eead84 |
4 files changed, 10 insertions(+), 10 deletions(-)
src/link/MachO/Archive.zig+4-4| ... | @@ -58,7 +58,7 @@ const ar_hdr = extern struct { | ... | @@ -58,7 +58,7 @@ const ar_hdr = extern struct { |
| 58 | 58 | ||
| 59 | const NameOrLength = union(enum) { | 59 | const NameOrLength = union(enum) { |
| 60 | Name: []const u8, | 60 | Name: []const u8, |
| 61 | Length: u64, | 61 | Length: u32, |
| 62 | }; | 62 | }; |
| 63 | fn nameOrLength(self: ar_hdr) !NameOrLength { | 63 | fn nameOrLength(self: ar_hdr) !NameOrLength { |
| 64 | const value = getValue(&self.ar_name); | 64 | const value = getValue(&self.ar_name); |
| ... | @@ -70,14 +70,14 @@ const ar_hdr = extern struct { | ... | @@ -70,14 +70,14 @@ const ar_hdr = extern struct { |
| 70 | } else { | 70 | } else { |
| 71 | // Name follows the header directly and its length is encoded in | 71 | // Name follows the header directly and its length is encoded in |
| 72 | // the name field. | 72 | // the name field. |
| 73 | const length = try std.fmt.parseInt(u64, value[slash_index + 1 ..], 10); | 73 | const length = try std.fmt.parseInt(u32, value[slash_index + 1 ..], 10); |
| 74 | return NameOrLength{ .Length = length }; | 74 | return NameOrLength{ .Length = length }; |
| 75 | } | 75 | } |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | fn size(self: ar_hdr) !u64 { | 78 | fn size(self: ar_hdr) !u32 { |
| 79 | const value = getValue(&self.ar_size); | 79 | const value = getValue(&self.ar_size); |
| 80 | return std.fmt.parseInt(u64, value, 10); | 80 | return std.fmt.parseInt(u32, value, 10); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | fn getValue(raw: []const u8) []const u8 { | 83 | fn getValue(raw: []const u8) []const u8 { |
src/link/MachO/Object.zig+2-2| ... | @@ -284,7 +284,7 @@ pub fn parseSections(self: *Object) !void { | ... | @@ -284,7 +284,7 @@ pub fn parseSections(self: *Object) !void { |
| 284 | for (seg.sections.items) |sect| { | 284 | for (seg.sections.items) |sect| { |
| 285 | log.debug("parsing section '{s},{s}'", .{ parseName(&sect.segname), parseName(&sect.sectname) }); | 285 | log.debug("parsing section '{s},{s}'", .{ parseName(&sect.segname), parseName(&sect.sectname) }); |
| 286 | // Read sections' code | 286 | // Read sections' code |
| 287 | var code = try self.allocator.alloc(u8, sect.size); | 287 | var code = try self.allocator.alloc(u8, @intCast(usize, sect.size)); |
| 288 | _ = try self.file.?.preadAll(code, sect.offset); | 288 | _ = try self.file.?.preadAll(code, sect.offset); |
| 289 | 289 | ||
| 290 | var section = Section{ | 290 | var section = Section{ |
| ... | @@ -461,7 +461,7 @@ pub fn parseDebugInfo(self: *Object) !void { | ... | @@ -461,7 +461,7 @@ pub fn parseDebugInfo(self: *Object) !void { |
| 461 | fn readSection(self: Object, allocator: *Allocator, index: u16) ![]u8 { | 461 | fn readSection(self: Object, allocator: *Allocator, index: u16) ![]u8 { |
| 462 | const seg = self.load_commands.items[self.segment_cmd_index.?].Segment; | 462 | const seg = self.load_commands.items[self.segment_cmd_index.?].Segment; |
| 463 | const sect = seg.sections.items[index]; | 463 | const sect = seg.sections.items[index]; |
| 464 | var buffer = try allocator.alloc(u8, sect.size); | 464 | var buffer = try allocator.alloc(u8, @intCast(usize, sect.size)); |
| 465 | _ = try self.file.?.preadAll(buffer, sect.offset); | 465 | _ = try self.file.?.preadAll(buffer, sect.offset); |
| 466 | return buffer; | 466 | return buffer; |
| 467 | } | 467 | } |
src/link/MachO/Zld.zig+1-1| ... | @@ -2214,7 +2214,7 @@ fn flush(self: *Zld) !void { | ... | @@ -2214,7 +2214,7 @@ fn flush(self: *Zld) !void { |
| 2214 | const seg = self.load_commands.items[self.data_segment_cmd_index.?].Segment; | 2214 | const seg = self.load_commands.items[self.data_segment_cmd_index.?].Segment; |
| 2215 | const sect = &seg.sections.items[index]; | 2215 | const sect = &seg.sections.items[index]; |
| 2216 | 2216 | ||
| 2217 | var buffer = try self.allocator.alloc(u8, sect.size); | 2217 | var buffer = try self.allocator.alloc(u8, @intCast(usize, sect.size)); |
| 2218 | defer self.allocator.free(buffer); | 2218 | defer self.allocator.free(buffer); |
| 2219 | _ = try self.file.?.preadAll(buffer, sect.offset); | 2219 | _ = try self.file.?.preadAll(buffer, sect.offset); |
| 2220 | 2220 |
src/link/MachO/reloc.zig+3-3| ... | @@ -179,12 +179,12 @@ pub fn parse( | ... | @@ -179,12 +179,12 @@ pub fn parse( |
| 179 | 179 | ||
| 180 | pub const RelocIterator = struct { | 180 | pub const RelocIterator = struct { |
| 181 | buffer: []const macho.relocation_info, | 181 | buffer: []const macho.relocation_info, |
| 182 | index: i64 = -1, | 182 | index: i32 = -1, |
| 183 | 183 | ||
| 184 | pub fn next(self: *RelocIterator) ?macho.relocation_info { | 184 | pub fn next(self: *RelocIterator) ?macho.relocation_info { |
| 185 | self.index += 1; | 185 | self.index += 1; |
| 186 | if (self.index < self.buffer.len) { | 186 | if (self.index < self.buffer.len) { |
| 187 | const reloc = self.buffer[@intCast(u64, self.index)]; | 187 | const reloc = self.buffer[@intCast(u32, self.index)]; |
| 188 | log.debug("relocation", .{}); | 188 | log.debug("relocation", .{}); |
| 189 | log.debug(" | type = {}", .{reloc.r_type}); | 189 | log.debug(" | type = {}", .{reloc.r_type}); |
| 190 | log.debug(" | offset = {}", .{reloc.r_address}); | 190 | log.debug(" | offset = {}", .{reloc.r_address}); |
| ... | @@ -199,6 +199,6 @@ pub const RelocIterator = struct { | ... | @@ -199,6 +199,6 @@ pub const RelocIterator = struct { |
| 199 | 199 | ||
| 200 | pub fn peek(self: RelocIterator) macho.relocation_info { | 200 | pub fn peek(self: RelocIterator) macho.relocation_info { |
| 201 | assert(self.index + 1 < self.buffer.len); | 201 | assert(self.index + 1 < self.buffer.len); |
| 202 | return self.buffer[@intCast(u64, self.index + 1)]; | 202 | return self.buffer[@intCast(u32, self.index + 1)]; |
| 203 | } | 203 | } |
| 204 | }; | 204 | }; |