From 641c9bcfd53837e80c942d44e99f57756d54de8e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 10 Apr 2013 15:33:44 +0000 Subject: Template MachOObjectFile over endianness too. llvm-svn: 179179 --- llvm/lib/Object/MachOObjectFile.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 33c63b0f896..f4df8e012cf 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -35,7 +35,7 @@ MachOObjectFileBase::MachOObjectFileBase(MemoryBuffer *Object, bool Is64bits, } bool MachOObjectFileBase::is64Bit() const { - return isa >(this); + return isa(this); } const MachOObjectFileBase::LoadCommand * @@ -86,9 +86,9 @@ ObjectFile *ObjectFile::createMachOObjectFile(MemoryBuffer *Buffer) { bool Is64Bits = Magic == "\xFE\xED\xFA\xCF" || Magic == "\xCF\xFA\xED\xFE"; ObjectFile *Ret; if (Is64Bits) - Ret = new MachOObjectFile(Buffer, ec); + Ret = new MachOObjectFile64Le(Buffer, ec); else - Ret = new MachOObjectFile(Buffer, ec); + Ret = new MachOObjectFile32Le(Buffer, ec); if (ec) return NULL; return Ret; @@ -127,8 +127,8 @@ MachOObjectFileBase::getSymbolTableEntryBase(DataRefImpl DRI, unsigned Index = DRI.d.b; unsigned SymbolTableEntrySize = is64Bit() ? - sizeof(MachOObjectFile::SymbolTableEntry) : - sizeof(MachOObjectFile::SymbolTableEntry); + sizeof(MachOObjectFile64Le::SymbolTableEntry) : + sizeof(MachOObjectFile32Le::SymbolTableEntry); uint64_t Offset = SymbolTableOffset + Index * SymbolTableEntrySize; StringRef Data = getData(Offset, SymbolTableEntrySize); @@ -314,10 +314,10 @@ MachOObjectFileBase::getSectionBase(DataRefImpl DRI) const { bool Is64 = is64Bit(); unsigned SegmentLoadSize = - Is64 ? sizeof(MachOObjectFile::SegmentLoadCommand) : - sizeof(MachOObjectFile::SegmentLoadCommand); - unsigned SectionSize = Is64 ? sizeof(MachOObjectFile::Section) : - sizeof(MachOObjectFile::Section); + Is64 ? sizeof(MachOObjectFile64Le::SegmentLoadCommand) : + sizeof(MachOObjectFile32Le::SegmentLoadCommand); + unsigned SectionSize = Is64 ? sizeof(MachOObjectFile64Le::Section) : + sizeof(MachOObjectFile32Le::Section); uintptr_t SectionAddr = CommandAddr + SegmentLoadSize + DRI.d.b * SectionSize; return reinterpret_cast(SectionAddr); -- cgit v1.2.3