mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 11:13:08 +00:00
More MachO.zig fixes ensuring 32bit compat
Partial resolution to #7614.
This commit is contained in:
parent
102e45e04f
commit
fbf269cc47
@ -1632,10 +1632,14 @@ pub fn populateMissingMetadata(self: *MachO) !void {
|
|||||||
}
|
}
|
||||||
if (self.dylinker_cmd_index == null) {
|
if (self.dylinker_cmd_index == null) {
|
||||||
self.dylinker_cmd_index = @intCast(u16, self.load_commands.items.len);
|
self.dylinker_cmd_index = @intCast(u16, self.load_commands.items.len);
|
||||||
const cmdsize = mem.alignForwardGeneric(u64, @sizeOf(macho.dylinker_command) + mem.lenZ(DEFAULT_DYLD_PATH), @sizeOf(u64));
|
const cmdsize = @intCast(u32, mem.alignForwardGeneric(
|
||||||
|
u64,
|
||||||
|
@sizeOf(macho.dylinker_command) + mem.lenZ(DEFAULT_DYLD_PATH),
|
||||||
|
@sizeOf(u64),
|
||||||
|
));
|
||||||
var dylinker_cmd = emptyGenericCommandWithData(macho.dylinker_command{
|
var dylinker_cmd = emptyGenericCommandWithData(macho.dylinker_command{
|
||||||
.cmd = macho.LC_LOAD_DYLINKER,
|
.cmd = macho.LC_LOAD_DYLINKER,
|
||||||
.cmdsize = @intCast(u32, cmdsize),
|
.cmdsize = cmdsize,
|
||||||
.name = @sizeOf(macho.dylinker_command),
|
.name = @sizeOf(macho.dylinker_command),
|
||||||
});
|
});
|
||||||
dylinker_cmd.data = try self.base.allocator.alloc(u8, cmdsize - dylinker_cmd.inner.name);
|
dylinker_cmd.data = try self.base.allocator.alloc(u8, cmdsize - dylinker_cmd.inner.name);
|
||||||
@ -1647,13 +1651,17 @@ pub fn populateMissingMetadata(self: *MachO) !void {
|
|||||||
}
|
}
|
||||||
if (self.libsystem_cmd_index == null) {
|
if (self.libsystem_cmd_index == null) {
|
||||||
self.libsystem_cmd_index = @intCast(u16, self.load_commands.items.len);
|
self.libsystem_cmd_index = @intCast(u16, self.load_commands.items.len);
|
||||||
const cmdsize = mem.alignForwardGeneric(u64, @sizeOf(macho.dylib_command) + mem.lenZ(LIB_SYSTEM_PATH), @sizeOf(u64));
|
const cmdsize = @intCast(u32, mem.alignForwardGeneric(
|
||||||
|
u64,
|
||||||
|
@sizeOf(macho.dylib_command) + mem.lenZ(LIB_SYSTEM_PATH),
|
||||||
|
@sizeOf(u64),
|
||||||
|
));
|
||||||
// TODO Find a way to work out runtime version from the OS version triple stored in std.Target.
|
// TODO Find a way to work out runtime version from the OS version triple stored in std.Target.
|
||||||
// In the meantime, we're gonna hardcode to the minimum compatibility version of 0.0.0.
|
// In the meantime, we're gonna hardcode to the minimum compatibility version of 0.0.0.
|
||||||
const min_version = 0x0;
|
const min_version = 0x0;
|
||||||
var dylib_cmd = emptyGenericCommandWithData(macho.dylib_command{
|
var dylib_cmd = emptyGenericCommandWithData(macho.dylib_command{
|
||||||
.cmd = macho.LC_LOAD_DYLIB,
|
.cmd = macho.LC_LOAD_DYLIB,
|
||||||
.cmdsize = @intCast(u32, cmdsize),
|
.cmdsize = cmdsize,
|
||||||
.dylib = .{
|
.dylib = .{
|
||||||
.name = @sizeOf(macho.dylib_command),
|
.name = @sizeOf(macho.dylib_command),
|
||||||
.timestamp = 2, // not sure why not simply 0; this is reverse engineered from Mach-O files
|
.timestamp = 2, // not sure why not simply 0; this is reverse engineered from Mach-O files
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user