authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-08-15 18:29:19+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-08-15 18:29:19+02:00
logd5f7963331e031326b8063673a2c43581565b538
tree9cca3bc039c0e006cc6262359960cfe24627c4cd
parentf82c26eb04590fc6083a3520b470333078cfc571

macho: adhoc code sign binaries targeting aarch64-xxx-simulator


1 files changed, 9 insertions(+), 2 deletions(-)

src/link/MachO.zig+9-2
...@@ -396,6 +396,13 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio...@@ -396,6 +396,13 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
396396
397pub fn createEmpty(gpa: *Allocator, options: link.Options) !*MachO {397pub fn createEmpty(gpa: *Allocator, options: link.Options) !*MachO {
398 const self = try gpa.create(MachO);398 const self = try gpa.create(MachO);
399 const cpu_arch = options.target.cpu.arch;
400 const os_tag = options.target.os.tag;
401 const abi = options.target.abi;
402 const page_size = if (cpu_arch == .aarch64) 0x4000 else 0x1000;
403 // Adhoc code signature is required when targeting aarch64-macos either directly or indirectly via the simulator
404 // ABI such as aarch64-ios-simulator, etc.
405 const requires_adhoc_codesig = cpu_arch == .aarch64 and (os_tag == .macos or abi == .simulator);
399406
400 self.* = .{407 self.* = .{
401 .base = .{408 .base = .{
...@@ -404,8 +411,8 @@ pub fn createEmpty(gpa: *Allocator, options: link.Options) !*MachO {...@@ -404,8 +411,8 @@ pub fn createEmpty(gpa: *Allocator, options: link.Options) !*MachO {
404 .allocator = gpa,411 .allocator = gpa,
405 .file = null,412 .file = null,
406 },413 },
407 .page_size = if (options.target.cpu.arch == .aarch64) 0x4000 else 0x1000,414 .page_size = page_size,
408 .requires_adhoc_codesig = options.target.cpu.arch == .aarch64 and options.target.os.tag == .macos,415 .requires_adhoc_codesig = requires_adhoc_codesig,
409 };416 };
410417
411 return self;418 return self;