[PATCH] D84714: [lld-macho] Implement -headerpad
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 27 16:44:46 PDT 2020
int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a reviewer: MaskRay.
Herald added subscribers: llvm-commits, dang.
Herald added a project: LLVM.
Tools like `install_name_tool` and `codesign` may modify the Mach-O
header and increase its size. The linker has to provide padding to make this
possible. This diff does that, plus sets its default value to 32 bytes (which
is what ld64 does).
Unlike ld64, however, we lay out our sections *exactly* `-headerpad` bytes from
the header, whereas ld64 just treats the padding requirement as a lower bound.
ld64 actually starts laying out the non-header sections in the __TEXT segment
from the end of the (page-aligned) segment rather than the front, so its
binaries typically have more than `-headerpad` bytes of actual padding. I
(jezng) am not sure whether it's important to emulate that behavior, so I'm
sticking with our simpler lay-out-from-front implementation for now.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84714
Files:
lld/Common/Args.cpp
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Options.td
lld/MachO/SyntheticSections.cpp
lld/include/lld/Common/Args.h
lld/test/MachO/headerpad.s
lld/test/MachO/local-got.s
lld/test/MachO/relocations.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84714.281082.patch
Type: text/x-patch
Size: 7037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200727/51f2a6dd/attachment.bin>
More information about the llvm-commits
mailing list