From c5f5e6153f4343f7e5191f3249575bce146e0c08 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sun, 5 Dec 2021 15:53:41 +0900 Subject: [PATCH] [Mach-O] Add -headerpad_max_install_names --- macho/cmdline.cc | 4 ++++ test/macho/headerpad-max-install-names.sh | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 test/macho/headerpad-max-install-names.sh diff --git a/macho/cmdline.cc b/macho/cmdline.cc index 1f147f8b..35fa9e34 100644 --- a/macho/cmdline.cc +++ b/macho/cmdline.cc @@ -33,6 +33,8 @@ Options: -framework ,[,] Search for a given framework -headerpad Allocate the size of padding after load commands + -headerpad_max_install_names + Allocate MAXPATHLEN byte padding after load commands -help Report usage information -l Search for a given library -lto_library Ignored @@ -200,6 +202,8 @@ void parse_nonpositional_args(Context &ctx, ctx.arg.headerpad = std::stol(std::string(arg), &pos, 16); if (pos != arg.size()) Fatal(ctx) << "malformed -headerpad: " << arg; + } else if (read_flag("-headerpad_max_install_names")) { + ctx.arg.headerpad = 1024; } else if (read_flag("-dynamic")) { ctx.arg.dynamic = true; } else if (read_arg("-e")) { diff --git a/test/macho/headerpad-max-install-names.sh b/test/macho/headerpad-max-install-names.sh new file mode 100755 index 00000000..711dbeaf --- /dev/null +++ b/test/macho/headerpad-max-install-names.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e +cd $(dirname $0) +mold=`pwd`/../../ld64.mold +echo -n "Testing $(basename -s .sh $0) ... " +t=$(pwd)/../../out/test/macho/$(basename -s .sh $0) +mkdir -p $t + +cat <