diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-10 21:55:43 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-10 21:55:43 +0000 |
commit | 7989460a1fba308128a7993cbabd178d2cc5ffa8 (patch) | |
tree | 9a9140e6b83555d05c3eed2d27d8164545654f5f /llvm/lib/Object/MachOObjectFile.cpp | |
parent | 55b4e5c208d614c71347d74069ff5a70a6c4ddcf (diff) | |
download | bcm5719-llvm-7989460a1fba308128a7993cbabd178d2cc5ffa8.tar.gz bcm5719-llvm-7989460a1fba308128a7993cbabd178d2cc5ffa8.zip |
Object: add getSectionAlignment.
llvm-svn: 141581
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 73fa8275c30..52b27b6b753 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -60,6 +60,7 @@ protected: virtual error_code getSectionAddress(DataRefImpl Sec, uint64_t &Res) const; virtual error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const; virtual error_code getSectionContents(DataRefImpl Sec, StringRef &Res) const; + virtual error_code getSectionAlignment(DataRefImpl Sec, uint64_t &Res) const; virtual error_code isSectionText(DataRefImpl Sec, bool &Res) const; virtual error_code isSectionData(DataRefImpl Sec, bool &Res) const; virtual error_code isSectionBSS(DataRefImpl Sec, bool &Res) const; @@ -481,6 +482,20 @@ error_code MachOObjectFile::getSectionContents(DataRefImpl DRI, return object_error::success; } +error_code MachOObjectFile::getSectionAlignment(DataRefImpl DRI, + uint64_t &Result) const { + if (is64BitLoadCommand(MachOObj, DRI)) { + InMemoryStruct<macho::Section64> Sect; + getSection64(DRI, Sect); + Result = 1 << Sect->Align; + } else { + InMemoryStruct<macho::Section> Sect; + getSection(DRI, Sect); + Result = 1 << Sect->Align; + } + return object_error::success; +} + error_code MachOObjectFile::isSectionText(DataRefImpl DRI, bool &Result) const { if (is64BitLoadCommand(MachOObj, DRI)) { |