Skip to content

Commit

Permalink
macho: set minimum default headerpad to 32 bytes
Browse files Browse the repository at this point in the history
This matches Apple's ld and LLVM's lld.
  • Loading branch information
kubkon committed Jul 3, 2024
1 parent 263c0ed commit 4e05685
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MachO/load_commands.zig
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ pub fn calcLoadCommandsSizeObject(macho_file: *MachO) u32 {

pub fn calcMinHeaderPadSize(macho_file: *MachO) u32 {
const options = &macho_file.options;
var padding: u32 = calcLoadCommandsSize(macho_file, false) + (options.headerpad orelse 0);
// We match Apple's ld and LLVM's lld here.
const default_headerpad_size = options.headerpad orelse 32;
var padding: u32 = calcLoadCommandsSize(macho_file, false) + default_headerpad_size;
log.debug("minimum requested headerpad size 0x{x}", .{padding + @sizeOf(macho.mach_header_64)});

if (options.headerpad_max_install_names) {
Expand Down

0 comments on commit 4e05685

Please sign in to comment.