zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 8b5d5f44e23c86082fba480f01092f2f7ffb3dfe (tree)
parent fd29ddc06c914a994ecb41714a7c4470ceda5af3
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Fri,  1 Apr 2022 14:33:37 +0200

macho: set CS_LINKER_SIGNED flag in code signature generated by zld

This way, if the user wants to use `codesign` (or other tool) they
will not be forced to `-f` force signature update. This matches
the behavior promoted by Apple's `ld64` linker.

Diffstat:
Mlib/std/macho.zig | 1+
Msrc/link/MachO/CodeSignature.zig | 2+-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/std/macho.zig b/lib/std/macho.zig @@ -1718,6 +1718,7 @@ pub const CS_SIGNER_TYPE_LEGACYVPN: u32 = 5; pub const CS_SIGNER_TYPE_MAC_APP_STORE: u32 = 6; pub const CS_ADHOC: u32 = 0x2; +pub const CS_LINKER_SIGNED: u32 = 0x20000; pub const CS_EXECSEG_MAIN_BINARY: u32 = 0x1; diff --git a/src/link/MachO/CodeSignature.zig b/src/link/MachO/CodeSignature.zig @@ -60,7 +60,7 @@ const CodeDirectory = struct { .magic = macho.CSMAGIC_CODEDIRECTORY, .length = @sizeOf(macho.CodeDirectory), .version = macho.CS_SUPPORTSEXECSEG, - .flags = macho.CS_ADHOC, + .flags = macho.CS_ADHOC | macho.CS_LINKER_SIGNED, .hashOffset = 0, .identOffset = @sizeOf(macho.CodeDirectory), .nSpecialSlots = 0,