-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Zig Version
0.11.0
Steps to Reproduce and Observed Behavior
I've been using zig cc in combination with rcodesign and I ran into an issue where rcodesign would complain about there not being enough space left for the signature. This only happened with some programs.
Interestingly this never happened for aarch64 builds. I decided to look into the Zig code, and I found this interesting bit: https://github.com/ziglang/zig/blob/master/src/link/MachO.zig#L691
I patched Zig with the following patch and the issue disappeared completely:
diff --git a/src/link/MachO/load_commands.zig b/src/link/MachO/load_commands.zig
index 8f803d98c..721b4e3c5 100644
--- a/src/link/MachO/load_commands.zig
+++ b/src/link/MachO/load_commands.zig
@@ -105,7 +105,7 @@ fn calcLCsSize(gpa: Allocator, options: *const link.Options, ctx: CalcLCsSizeCtx
const target = options.target;
const requires_codesig = blk: {
if (options.entitlements) |_| break :blk true;
- if (target.cpu.arch == .aarch64 and (target.os.tag == .macos or target.abi == .simulator))
+ if (target.os.tag == .macos or target.abi == .simulator)
break :blk true;
break :blk false;
};Is it possible to add a flag to enable codesigning using zig cc? Or enable it by default, seeing it's already doing that on aarch64? What are the reasons for it to be disabled on amd64?
Expected Behavior
Either codesigning should be enabled by default for macos/amd64 too, or there should be a flag in zig cc to enable it.