diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-04-08 13:25:33 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-04-08 13:25:33 +0000 |
commit | 9d55c099d628d7835dd1b502cb29c96cae350099 (patch) | |
tree | 335fd71d28c964c9d5fc398252a8a27b4273e2fd /include/llvm/Object | |
parent | bd7c634ab90ed63ee409fe781360cd42b05780f3 (diff) | |
download | external_llvm-9d55c099d628d7835dd1b502cb29c96cae350099.tar.gz external_llvm-9d55c099d628d7835dd1b502cb29c96cae350099.tar.bz2 external_llvm-9d55c099d628d7835dd1b502cb29c96cae350099.zip |
Add all 4 MachO object types. Use the stored type to implement is64Bits().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179021 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object')
-rw-r--r-- | include/llvm/Object/Binary.h | 17 | ||||
-rw-r--r-- | include/llvm/Object/MachO.h | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/include/llvm/Object/Binary.h b/include/llvm/Object/Binary.h index 8bbcd8b4d4..ac5bfed4bf 100644 --- a/include/llvm/Object/Binary.h +++ b/include/llvm/Object/Binary.h @@ -41,11 +41,17 @@ protected: // Object and children. ID_StartObjects, ID_COFF, + ID_ELF32L, // ELF 32-bit, little endian ID_ELF32B, // ELF 32-bit, big endian ID_ELF64L, // ELF 64-bit, little endian ID_ELF64B, // ELF 64-bit, big endian - ID_MachO, + + ID_MachO32L, // MachO 32-bit, little endian + ID_MachO32B, // MachO 32-bit, big endian + ID_MachO64L, // MachO 64-bit, little endian + ID_MachO64B, // MachO 64-bit, big endian + ID_EndObjects }; @@ -56,6 +62,13 @@ protected: return is64Bits ? ID_ELF64B : ID_ELF32B; } + static unsigned int getMachOType(bool isLE, bool is64Bits) { + if (isLE) + return is64Bits ? ID_MachO64L : ID_MachO32L; + else + return is64Bits ? ID_MachO64B : ID_MachO32B; + } + public: virtual ~Binary(); @@ -79,7 +92,7 @@ public: } bool isMachO() const { - return TypeID == ID_MachO; + return TypeID >= ID_MachO32L && TypeID <= ID_MachO64B; } bool isCOFF() const { diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index 5024d50720..226b24ffc9 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -139,7 +139,7 @@ namespace MachOFormat { class MachOObjectFile : public ObjectFile { public: - MachOObjectFile(MemoryBuffer *Object, error_code &ec); + MachOObjectFile(MemoryBuffer *Object, bool Is64bits, error_code &ec); virtual symbol_iterator begin_symbols() const; virtual symbol_iterator end_symbols() const; |