mirror of
https://github.com/rui314/mold.git
synced 2024-09-20 09:27:45 +03:00
[Mach-O] Add -headerpad_max_install_names
This commit is contained in:
parent
6fae1d8555
commit
c5f5e6153f
@ -33,6 +33,8 @@ Options:
|
||||
-framework <NAME>,[,<SUFFIX>]
|
||||
Search for a given framework
|
||||
-headerpad <SIZE> Allocate the size of padding after load commands
|
||||
-headerpad_max_install_names
|
||||
Allocate MAXPATHLEN byte padding after load commands
|
||||
-help Report usage information
|
||||
-l<LIB> Search for a given library
|
||||
-lto_library <FILE> Ignored
|
||||
@ -200,6 +202,8 @@ void parse_nonpositional_args(Context<E> &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")) {
|
||||
|
16
test/macho/headerpad-max-install-names.sh
Executable file
16
test/macho/headerpad-max-install-names.sh
Executable file
@ -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 <<EOF | cc -o $t/a.o -c -xc -
|
||||
int main() {}
|
||||
EOF
|
||||
|
||||
clang -fuse-ld=$mold -o $t/exe $t/a.o -Wl,-headerpad_max_install_names
|
||||
otool -l $t/exe | grep -A5 'sectname __text' | grep -q 'addr 0x0000000100000978'
|
||||
|
||||
echo OK
|
Loading…
Reference in New Issue
Block a user