aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2021-01-01 21:28:52 +0100
committerGitHub <noreply@github.com>2021-01-01 21:28:52 +0100
commit5dfeb6cbc89d64f2a44eece41918e1c391c7c989 (patch)
tree65b5a182a9f8819635f38e401d81fde82cb19e77 /src/link/MachO.zig
parent1cef0be01b80b087492c652b18304ec1946a81e6 (diff)
downloadzig-5dfeb6cbc89d64f2a44eece41918e1c391c7c989.tar.gz
zig-5dfeb6cbc89d64f2a44eece41918e1c391c7c989.zip
macho: unblock stage2 on 32bit platforms (#7632)
* macho: unblock stage2 on 32bit platforms Unblocks compilation of stage2 on 32bit platforms, and fixes #7630. * Use libstd convention: reads - usize, writes - u64
Diffstat (limited to 'src/link/MachO.zig')
-rw-r--r--src/link/MachO.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index 88cb40db3d..6abbae2c26 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -907,7 +907,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
const size = try self.binding_info_table.calcSize();
assert(dyld_info.bind_size >= size);
- var buffer = try self.base.allocator.alloc(u8, size);
+ var buffer = try self.base.allocator.alloc(u8, @intCast(usize, size));
defer self.base.allocator.free(buffer);
var stream = std.io.fixedBufferStream(buffer);
@@ -919,7 +919,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
const size = try self.lazy_binding_info_table.calcSize();
assert(dyld_info.lazy_bind_size >= size);
- var buffer = try self.base.allocator.alloc(u8, size);
+ var buffer = try self.base.allocator.alloc(u8, @intCast(usize, size));
defer self.base.allocator.free(buffer);
var stream = std.io.fixedBufferStream(buffer);
@@ -1875,13 +1875,13 @@ pub fn makeStaticString(comptime bytes: []const u8) [16]u8 {
fn makeString(self: *MachO, bytes: []const u8) !u32 {
try self.string_table.ensureCapacity(self.base.allocator, self.string_table.items.len + bytes.len + 1);
- const result = self.string_table.items.len;
+ const result = @intCast(u32, self.string_table.items.len);
self.string_table.appendSliceAssumeCapacity(bytes);
self.string_table.appendAssumeCapacity(0);
self.string_table_dirty = true;
if (self.d_sym) |*ds|
ds.string_table_dirty = true;
- return @intCast(u32, result);
+ return result;
}
fn getString(self: *MachO, str_off: u32) []const u8 {
@@ -2245,7 +2245,7 @@ fn writeExportTrie(self: *MachO) !void {
}
try trie.finalize();
- var buffer = try self.base.allocator.alloc(u8, trie.size);
+ var buffer = try self.base.allocator.alloc(u8, @intCast(usize, trie.size));
defer self.base.allocator.free(buffer);
var stream = std.io.fixedBufferStream(buffer);
const nwritten = try trie.write(stream.writer());
@@ -2275,7 +2275,7 @@ fn writeBindingInfoTable(self: *MachO) !void {
defer tracy.end();
const size = try self.binding_info_table.calcSize();
- var buffer = try self.base.allocator.alloc(u8, size);
+ var buffer = try self.base.allocator.alloc(u8, @intCast(usize, size));
defer self.base.allocator.free(buffer);
var stream = std.io.fixedBufferStream(buffer);
@@ -2303,7 +2303,7 @@ fn writeLazyBindingInfoTable(self: *MachO) !void {
if (!self.lazy_binding_info_dirty) return;
const size = try self.lazy_binding_info_table.calcSize();
- var buffer = try self.base.allocator.alloc(u8, size);
+ var buffer = try self.base.allocator.alloc(u8, @intCast(usize, size));
defer self.base.allocator.free(buffer);
var stream = std.io.fixedBufferStream(buffer);
@@ -2400,7 +2400,7 @@ fn updateLinkeditSegmentSizes(self: *MachO) !void {
fn writeLoadCommands(self: *MachO) !void {
if (!self.load_commands_dirty) return;
- var sizeofcmds: usize = 0;
+ var sizeofcmds: u32 = 0;
for (self.load_commands.items) |lc| {
sizeofcmds += lc.cmdsize();
}