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.
This commit is contained in:
Jakub Konka 2022-04-01 14:33:37 +02:00
parent fd29ddc06c
commit 8b5d5f44e2
2 changed files with 2 additions and 1 deletions

View File

@ -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;

View File

@ -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,