| ... | ... | @@ -733,7 +733,8 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { |
| 733 | 733 | // Pad out space for code signature |
| 734 | 734 | const text_cmd = parser.load_commands.items[parser.text_cmd_index.?].Segment.inner; |
| 735 | 735 | const dataoff = @intCast(u32, mem.alignForward(parser.end_pos.?, @sizeOf(u64))); |
| 736 | | const datasize = 0x400000; |
| 736 | const emit = self.base.options.emit.?; |
| 737 | const datasize = CodeSignature.calcCodeSignaturePadding(emit.sub_path, dataoff); |
| 737 | 738 | const code_sig = macho.linkedit_data_command{ |
| 738 | 739 | .cmd = macho.LC_CODE_SIGNATURE, |
| 739 | 740 | .cmdsize = @sizeOf(macho.linkedit_data_command), |
| ... | ... | @@ -772,7 +773,6 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { |
| 772 | 773 | // Generate adhoc code signature |
| 773 | 774 | var signature = CodeSignature.init(self.base.allocator); |
| 774 | 775 | defer signature.deinit(); |
| 775 | | const emit = self.base.options.emit.?; |
| 776 | 776 | try signature.calcAdhocSignature( |
| 777 | 777 | out_file, |
| 778 | 778 | emit.sub_path, |
| ... | ... | @@ -1723,7 +1723,7 @@ fn writeSymbolTable(self: *MachO) !void { |
| 1723 | 1723 | fn writeCodeSignaturePadding(self: *MachO) !void { |
| 1724 | 1724 | const code_sig_cmd = &self.load_commands.items[self.code_signature_cmd_index.?].LinkeditData; |
| 1725 | 1725 | const fileoff = self.linkedit_segment_next_offset.?; |
| 1726 | | const datasize: u32 = 0x1000; // TODO Calculate the expected size of the signature. |
| 1726 | const datasize = CodeSignature.calcCodeSignaturePadding(self.base.options.emit.?.sub_path, fileoff); |
| 1727 | 1727 | code_sig_cmd.dataoff = fileoff; |
| 1728 | 1728 | code_sig_cmd.datasize = datasize; |
| 1729 | 1729 | |