summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
diff options
context:
space:
mode:
authorNick Kledzik <kledzik@apple.com>2014-07-30 00:58:06 +0000
committerNick Kledzik <kledzik@apple.com>2014-07-30 00:58:06 +0000
commit2fcbe822c0be8773505afd9e4080d71f8a05953d (patch)
tree255020232526c15b71f88569408a13cd6146244b /lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
parentf73da98f488c8177eb69b846a9f6045e01db6792 (diff)
downloadbcm5719-llvm-2fcbe822c0be8773505afd9e4080d71f8a05953d.tar.gz
bcm5719-llvm-2fcbe822c0be8773505afd9e4080d71f8a05953d.zip
[mach-o] Add support for -sectalign option
The -sectalign option is used to increase the alignment required for a section. It required some reworking of how the __TEXT segment is laid out because that segment also contains the mach_header and load commands. And the size of load commands depend on the number of segments, sections, and dependent dylibs used. Using this option will simplify some future test cases because the final address of code can be pinned down, making tests of its content easier. llvm-svn: 214268
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
index fc90e8b34cb..5d9f46dd582 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
@@ -58,6 +58,9 @@ public:
/// Returns the final file size as computed in the constructor.
size_t size() const;
+ // Returns size of the mach_header and load commands.
+ size_t headerAndLoadCommandsSize() const;
+
/// Writes the normalized file as a binary mach-o file to the specified
/// path. This does not have a stream interface because the generated
/// file may need the 'x' bit set.
@@ -200,7 +203,7 @@ private:
size_t headerAndLoadCommandsSize(const NormalizedFile &file) {
MachOFileLayout layout(file);
- return layout.size();
+ return layout.headerAndLoadCommandsSize();
}
StringRef MachOFileLayout::dyldPath() {
@@ -212,6 +215,9 @@ uint32_t MachOFileLayout::pointerAlign(uint32_t value) {
}
+size_t MachOFileLayout::headerAndLoadCommandsSize() const {
+ return _endOfLoadCommands;
+}
MachOFileLayout::MachOFileLayout(const NormalizedFile &file)
OpenPOWER on IntegriCloud