diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-04-05 18:45:28 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-04-05 18:45:28 +0000 |
commit | 0e5dc8aacb548d51b0ca9035a7d449a8e5862dd2 (patch) | |
tree | e3cdf4643735dbac87ba2dfc9b04f83560a33822 /include | |
parent | 5c762e0c2511b72867559bca567cdb4c85c9ed01 (diff) | |
download | external_llvm-0e5dc8aacb548d51b0ca9035a7d449a8e5862dd2.zip external_llvm-0e5dc8aacb548d51b0ca9035a7d449a8e5862dd2.tar.gz external_llvm-0e5dc8aacb548d51b0ca9035a7d449a8e5862dd2.tar.bz2 |
Define versions of Section that are explicitly marked as little endian.
These should really be templated like ELF, but this is a start.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178896 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Object/MachO.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index b5aa539..badd440 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -19,12 +19,44 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Object/MachOObject.h" #include "llvm/Object/ObjectFile.h" +#include "llvm/Support/Endian.h" #include "llvm/Support/MachO.h" #include "llvm/Support/raw_ostream.h" namespace llvm { namespace object { +namespace MachOFormat { + struct Section { + char Name[16]; + char SegmentName[16]; + support::ulittle32_t Address; + support::ulittle32_t Size; + support::ulittle32_t Offset; + support::ulittle32_t Align; + support::ulittle32_t RelocationTableOffset; + support::ulittle32_t NumRelocationTableEntries; + support::ulittle32_t Flags; + support::ulittle32_t Reserved1; + support::ulittle32_t Reserved2; + }; + + struct Section64 { + char Name[16]; + char SegmentName[16]; + support::ulittle64_t Address; + support::ulittle64_t Size; + support::ulittle32_t Offset; + support::ulittle32_t Align; + support::ulittle32_t RelocationTableOffset; + support::ulittle32_t NumRelocationTableEntries; + support::ulittle32_t Flags; + support::ulittle32_t Reserved1; + support::ulittle32_t Reserved2; + support::ulittle32_t Reserved3; + }; +} + typedef MachOObject::LoadCommandInfo LoadCommandInfo; class MachOObjectFile : public ObjectFile { @@ -127,8 +159,8 @@ private: void getSymbol64TableEntry(DataRefImpl DRI, InMemoryStruct<macho::Symbol64TableEntry> &Res) const; void moveToNextSymbol(DataRefImpl &DRI) const; - const macho::Section *getSection(DataRefImpl DRI) const; - const macho::Section64 *getSection64(DataRefImpl DRI) const; + const MachOFormat::Section *getSection(DataRefImpl DRI) const; + const MachOFormat::Section64 *getSection64(DataRefImpl DRI) const; void getRelocation(DataRefImpl Rel, InMemoryStruct<macho::RelocationEntry> &Res) const; std::size_t getSectionIndex(DataRefImpl Sec) const; |