llvm-project/lld/MachO
Jez Ng 22e6648a18 [lld-macho] Implement -headerpad
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.
We should consider implementing the same alignment behavior.

Reviewed By: #lld-macho, compnerd

Differential Revision: https://reviews.llvm.org/D84714
2020-07-30 14:29:31 -07:00
..
Arch [lld-macho] Partial support for weak definitions 2020-07-24 15:55:25 -07:00
CMakeLists.txt [lld] Fix shared library build by adding the missing dependency. 2020-06-08 16:12:58 -04:00
Config.h [lld-macho] Implement -headerpad 2020-07-30 14:29:31 -07:00
Driver.cpp [lld-macho] Implement -headerpad 2020-07-30 14:29:31 -07:00
Driver.h [lld-macho] Specify the complete set of command-line options for ld64 2020-06-15 12:50:20 -07:00
ExportTrie.cpp [lld-macho] Partial support for weak definitions 2020-07-24 15:55:25 -07:00
ExportTrie.h [lld-macho] Use export trie instead of symtab when linking against dylibs 2020-05-09 20:56:22 -07:00
InputFiles.cpp [lld-macho] Partial support for weak definitions 2020-07-24 15:55:25 -07:00
InputFiles.h lld: remove old test support path 2020-06-16 15:57:58 -07:00
InputSection.cpp [lld-macho] Ensure __bss sections we output have file offset of zero 2020-06-17 20:41:28 -07:00
InputSection.h [lld-macho] Ensure __bss sections we output have file offset of zero 2020-06-17 20:41:28 -07:00
MachOStructs.h [lld-macho] Ensure reads from nlist_64 structs are aligned when necessary 2020-06-02 13:19:38 -07:00
MergedOutputSection.cpp [lld-macho] Handle alignment correctly when merging InputSections 2020-06-17 20:41:28 -07:00
MergedOutputSection.h [lld-macho] Refactor segment/section creation, sorting, and merging 2020-06-21 17:13:59 -07:00
Options.td [lld-macho] Implement -headerpad 2020-07-30 14:29:31 -07:00
OutputSection.cpp [lld-macho] Refactor segment/section creation, sorting, and merging 2020-06-21 17:13:59 -07:00
OutputSection.h [lld-macho] Refactor segment/section creation, sorting, and merging 2020-06-21 17:13:59 -07:00
OutputSegment.cpp [lld-macho] Refactor segment/section creation, sorting, and merging 2020-06-21 17:13:59 -07:00
OutputSegment.h [lld-macho] Refactor segment/section creation, sorting, and merging 2020-06-21 17:13:59 -07:00
SymbolTable.cpp [lld-macho] Support __dso_handle for C++ 2020-07-30 14:28:41 -07:00
SymbolTable.h [lld-macho] Support __dso_handle for C++ 2020-07-30 14:28:41 -07:00
Symbols.cpp [lld-macho] Support __dso_handle for C++ 2020-07-30 14:28:41 -07:00
Symbols.h [lld-macho] Support __dso_handle for C++ 2020-07-30 14:28:41 -07:00
SyntheticSections.cpp [lld-macho] Implement -headerpad 2020-07-30 14:29:31 -07:00
SyntheticSections.h [lld-macho] Support __dso_handle for C++ 2020-07-30 14:28:41 -07:00
Target.cpp Reland D75382 "[lld] Initial commit for new Mach-O backend" 2020-04-02 12:03:43 -07:00
Target.h [lld-macho] Support binding dysyms to any section 2020-07-02 21:21:01 -07:00
Writer.cpp [lld-macho] Support __dso_handle for C++ 2020-07-30 14:28:41 -07:00
Writer.h [lld-macho] Extend SyntheticSections to cover all segment load commands 2020-04-27 12:58:12 -07:00