summaryrefslogtreecommitdiffstats
path: root/lld/include
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/include
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/include')
-rw-r--r--lld/include/lld/ReaderWriter/MachOLinkingContext.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/lld/include/lld/ReaderWriter/MachOLinkingContext.h b/lld/include/lld/ReaderWriter/MachOLinkingContext.h
index 82c782147ed..fe13aab7dbc 100644
--- a/lld/include/lld/ReaderWriter/MachOLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/MachOLinkingContext.h
@@ -166,6 +166,12 @@ public:
_existingPaths.insert(path);
}
+ /// Add section alignment constraint on final layout.
+ void addSectionAlignment(StringRef seg, StringRef sect, uint8_t align2);
+
+ /// Returns true if specified section had alignment constraints.
+ bool sectionAligned(StringRef seg, StringRef sect, uint8_t &align2) const;
+
StringRef dyldPath() const { return "/usr/lib/dyld"; }
/// Stub creation Pass should be run.
@@ -201,6 +207,12 @@ private:
uint32_t cpusubtype;
};
+ struct SectionAlign {
+ StringRef segmentName;
+ StringRef sectionName;
+ uint8_t align2;
+ };
+
static ArchInfo _s_archInfos[];
std::set<StringRef> _existingPaths; // For testing only.
@@ -222,6 +234,7 @@ private:
StringRef _bundleLoader;
mutable std::unique_ptr<mach_o::ArchHandler> _archHandler;
mutable std::unique_ptr<Writer> _writer;
+ std::vector<SectionAlign> _sectAligns;
};
} // end namespace lld
OpenPOWER on IntegriCloud