From 335f1d46d82a4d6b5a7317ccc73178a47b62fc25 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 8 Apr 2013 20:45:01 +0000 Subject: [PATCH] Template the MachO types over the word size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179051 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/MachO.h | 39 +++++--- lib/Object/MachOObjectFile.cpp | 151 ++++++++++++++++------------- tools/llvm-readobj/MachODumper.cpp | 11 ++- 3 files changed, 119 insertions(+), 82 deletions(-) diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index 226b24ffc9a..5c50ceb2b67 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -27,7 +27,11 @@ namespace llvm { namespace object { namespace MachOFormat { - struct Section { + template + struct Section; + + template<> + struct Section { char Name[16]; char SegmentName[16]; support::ulittle32_t Address; @@ -41,7 +45,8 @@ namespace MachOFormat { support::ulittle32_t Reserved2; }; - struct Section64 { + template<> + struct Section { char Name[16]; char SegmentName[16]; support::ulittle64_t Address; @@ -61,7 +66,11 @@ namespace MachOFormat { support::ulittle32_t Word1; }; - struct SymbolTableEntry { + template + struct SymbolTableEntry; + + template<> + struct SymbolTableEntry { support::ulittle32_t StringIndex; uint8_t Type; uint8_t SectionIndex; @@ -69,7 +78,8 @@ namespace MachOFormat { support::ulittle32_t Value; }; - struct Symbol64TableEntry { + template<> + struct SymbolTableEntry { support::ulittle32_t StringIndex; uint8_t Type; uint8_t SectionIndex; @@ -91,7 +101,11 @@ namespace MachOFormat { support::ulittle32_t StringTableSize; }; - struct SegmentLoadCommand { + template + struct SegmentLoadCommand; + + template<> + struct SegmentLoadCommand { support::ulittle32_t Type; support::ulittle32_t Size; char Name[16]; @@ -105,7 +119,8 @@ namespace MachOFormat { support::ulittle32_t Flags; }; - struct Segment64LoadCommand { + template<> + struct SegmentLoadCommand { support::ulittle32_t Type; support::ulittle32_t Size; char Name[16]; @@ -165,11 +180,11 @@ public: ArrayRef getSectionRawName(DataRefImpl Sec) const; ArrayRefgetSectionRawFinalSegmentName(DataRefImpl Sec) const; - const MachOFormat::Section64 *getSection64(DataRefImpl DRI) const; - const MachOFormat::Section *getSection(DataRefImpl DRI) const; - const MachOFormat::Symbol64TableEntry * + const MachOFormat::Section *getSection64(DataRefImpl DRI) const; + const MachOFormat::Section *getSection(DataRefImpl DRI) const; + const MachOFormat::SymbolTableEntry * getSymbol64TableEntry(DataRefImpl DRI) const; - const MachOFormat::SymbolTableEntry * + const MachOFormat::SymbolTableEntry * getSymbolTableEntry(DataRefImpl DRI) const; bool is64Bit() const; const MachOFormat::LoadCommand *getLoadCommandInfo(unsigned Index) const; @@ -242,11 +257,11 @@ private: void moveToNextSection(DataRefImpl &DRI) const; - const MachOFormat::SymbolTableEntry * + const MachOFormat::SymbolTableEntry * getSymbolTableEntry(DataRefImpl DRI, const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const; - const MachOFormat::Symbol64TableEntry * + const MachOFormat::SymbolTableEntry * getSymbol64TableEntry(DataRefImpl DRI, const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const; diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index 86499cf0748..30ab00f450c 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/lib/Object/MachOObjectFile.cpp @@ -116,7 +116,7 @@ void MachOObjectFile::moveToNextSymbol(DataRefImpl &DRI) const { } } -const MachOFormat::SymbolTableEntry * +const MachOFormat::SymbolTableEntry * MachOObjectFile::getSymbolTableEntry(DataRefImpl DRI) const { const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a); const MachOFormat::SymtabLoadCommand *SymtabLoadCmd = @@ -125,18 +125,20 @@ MachOObjectFile::getSymbolTableEntry(DataRefImpl DRI) const { return getSymbolTableEntry(DRI, SymtabLoadCmd); } -const MachOFormat::SymbolTableEntry * +const MachOFormat::SymbolTableEntry * MachOObjectFile::getSymbolTableEntry(DataRefImpl DRI, const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const { uint64_t SymbolTableOffset = SymtabLoadCmd->SymbolTableOffset; unsigned Index = DRI.d.b; uint64_t Offset = (SymbolTableOffset + - Index * sizeof(macho::SymbolTableEntry)); - StringRef Data = getData(Offset, sizeof(MachOFormat::SymbolTableEntry)); - return reinterpret_cast(Data.data()); + Index * sizeof(MachOFormat::SymbolTableEntry)); + StringRef Data = + getData(Offset, sizeof(MachOFormat::SymbolTableEntry)); + return + reinterpret_cast*>(Data.data()); } -const MachOFormat::Symbol64TableEntry* +const MachOFormat::SymbolTableEntry* MachOObjectFile::getSymbol64TableEntry(DataRefImpl DRI) const { const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a); const MachOFormat::SymtabLoadCommand *SymtabLoadCmd = @@ -145,15 +147,16 @@ MachOObjectFile::getSymbol64TableEntry(DataRefImpl DRI) const { return getSymbol64TableEntry(DRI, SymtabLoadCmd); } -const MachOFormat::Symbol64TableEntry* +const MachOFormat::SymbolTableEntry* MachOObjectFile::getSymbol64TableEntry(DataRefImpl DRI, const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const { uint64_t SymbolTableOffset = SymtabLoadCmd->SymbolTableOffset; unsigned Index = DRI.d.b; uint64_t Offset = (SymbolTableOffset + - Index * sizeof(macho::Symbol64TableEntry)); - StringRef Data = getData(Offset, sizeof(MachOFormat::Symbol64TableEntry)); - return reinterpret_cast(Data.data()); + Index * sizeof(MachOFormat::SymbolTableEntry)); + StringRef Data = getData(Offset, sizeof(MachOFormat::SymbolTableEntry)); + return + reinterpret_cast*>(Data.data()); } error_code MachOObjectFile::getSymbolNext(DataRefImpl DRI, @@ -175,11 +178,11 @@ error_code MachOObjectFile::getSymbolName(DataRefImpl DRI, uint32_t StringIndex; if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = + const MachOFormat::SymbolTableEntry *Entry = getSymbol64TableEntry(DRI, SymtabLoadCmd); StringIndex = Entry->StringIndex; } else { - const MachOFormat::SymbolTableEntry *Entry = + const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI, SymtabLoadCmd); StringIndex = Entry->StringIndex; } @@ -193,18 +196,20 @@ error_code MachOObjectFile::getSymbolName(DataRefImpl DRI, error_code MachOObjectFile::getSymbolFileOffset(DataRefImpl DRI, uint64_t &Result) const { if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbol64TableEntry(DRI); Result = Entry->Value; if (Entry->SectionIndex) { - const MachOFormat::Section64 *Section = + const MachOFormat::Section *Section = getSection64(Sections[Entry->SectionIndex-1]); Result += Section->Offset - Section->Address; } } else { - const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbolTableEntry(DRI); Result = Entry->Value; if (Entry->SectionIndex) { - const MachOFormat::Section *Section = + const MachOFormat::Section *Section = getSection(Sections[Entry->SectionIndex-1]); Result += Section->Offset - Section->Address; } @@ -216,10 +221,12 @@ error_code MachOObjectFile::getSymbolFileOffset(DataRefImpl DRI, error_code MachOObjectFile::getSymbolAddress(DataRefImpl DRI, uint64_t &Result) const { if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbol64TableEntry(DRI); Result = Entry->Value; } else { - const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbolTableEntry(DRI); Result = Entry->Value; } return object_error::success; @@ -232,7 +239,8 @@ error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI, uint64_t EndOffset = 0; uint8_t SectionIndex; if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbol64TableEntry(DRI); BeginOffset = Entry->Value; SectionIndex = Entry->SectionIndex; if (!SectionIndex) { @@ -259,7 +267,8 @@ error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI, DRI.d.b++; } } else { - const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbolTableEntry(DRI); BeginOffset = Entry->Value; SectionIndex = Entry->SectionIndex; if (!SectionIndex) { @@ -300,11 +309,13 @@ error_code MachOObjectFile::getSymbolNMTypeChar(DataRefImpl DRI, char &Result) const { uint8_t Type, Flags; if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbol64TableEntry(DRI); Type = Entry->Type; Flags = Entry->Flags; } else { - const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbolTableEntry(DRI); Type = Entry->Type; Flags = Entry->Flags; } @@ -334,11 +345,13 @@ error_code MachOObjectFile::getSymbolFlags(DataRefImpl DRI, uint16_t MachOFlags; uint8_t MachOType; if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbol64TableEntry(DRI); MachOFlags = Entry->Flags; MachOType = Entry->Type; } else { - const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + getSymbolTableEntry(DRI); MachOFlags = Entry->Flags; MachOType = Entry->Type; } @@ -371,10 +384,12 @@ error_code MachOObjectFile::getSymbolSection(DataRefImpl Symb, section_iterator &Res) const { uint8_t index; if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(Symb); + const MachOFormat::SymbolTableEntry *Entry = + getSymbol64TableEntry(Symb); index = Entry->SectionIndex; } else { - const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(Symb); + const MachOFormat::SymbolTableEntry *Entry = + getSymbolTableEntry(Symb); index = Entry->SectionIndex; } @@ -390,10 +405,12 @@ error_code MachOObjectFile::getSymbolType(DataRefImpl Symb, SymbolRef::Type &Res) const { uint8_t n_type; if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(Symb); + const MachOFormat::SymbolTableEntry *Entry = + getSymbol64TableEntry(Symb); n_type = Entry->Type; } else { - const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(Symb); + const MachOFormat::SymbolTableEntry *Entry = + getSymbolTableEntry(Symb); n_type = Entry->Type; } Res = SymbolRef::ST_Other; @@ -465,14 +482,14 @@ void MachOObjectFile::moveToNextSection(DataRefImpl &DRI) const { while (DRI.d.a < LoadCommandCount) { const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a); if (Command->Type == macho::LCT_Segment) { - const MachOFormat::SegmentLoadCommand *SegmentLoadCmd = - reinterpret_cast(Command); + const MachOFormat::SegmentLoadCommand *SegmentLoadCmd = + reinterpret_cast*>(Command); if (DRI.d.b < SegmentLoadCmd->NumSections) return; } else if (Command->Type == macho::LCT_Segment64) { - const MachOFormat::Segment64LoadCommand *Segment64LoadCmd = - reinterpret_cast(Command); - if (DRI.d.b < Segment64LoadCmd->NumSections) + const MachOFormat::SegmentLoadCommand *SegmentLoadCmd = + reinterpret_cast*>(Command); + if (DRI.d.b < SegmentLoadCmd->NumSections) return; } @@ -489,13 +506,14 @@ error_code MachOObjectFile::getSectionNext(DataRefImpl DRI, return object_error::success; } -const MachOFormat::Section *MachOObjectFile::getSection(DataRefImpl DRI) const { +const MachOFormat::Section * +MachOObjectFile::getSection(DataRefImpl DRI) const { assert(!is64Bit()); const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a); uintptr_t CommandAddr = reinterpret_cast(Command); uintptr_t SectionAddr = CommandAddr + sizeof(macho::SegmentLoadCommand) + - DRI.d.b * sizeof(MachOFormat::Section); - return reinterpret_cast(SectionAddr); + DRI.d.b * sizeof(MachOFormat::Section); + return reinterpret_cast*>(SectionAddr); } std::size_t MachOObjectFile::getSectionIndex(DataRefImpl Sec) const { @@ -505,14 +523,14 @@ std::size_t MachOObjectFile::getSectionIndex(DataRefImpl Sec) const { return std::distance(Sections.begin(), loc); } -const MachOFormat::Section64 * +const MachOFormat::Section * MachOObjectFile::getSection64(DataRefImpl DRI) const { assert(is64Bit()); const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a); uintptr_t CommandAddr = reinterpret_cast(Command); uintptr_t SectionAddr = CommandAddr + sizeof(macho::Segment64LoadCommand) + - DRI.d.b * sizeof(MachOFormat::Section64); - return reinterpret_cast(SectionAddr); + DRI.d.b * sizeof(MachOFormat::Section); + return reinterpret_cast*>(SectionAddr); } static StringRef parseSegmentOrSectionName(const char *P) { @@ -525,10 +543,10 @@ static StringRef parseSegmentOrSectionName(const char *P) { ArrayRef MachOObjectFile::getSectionRawName(DataRefImpl DRI) const { if (is64Bit()) { - const MachOFormat::Section64 *sec = getSection64(DRI); + const MachOFormat::Section *sec = getSection64(DRI); return ArrayRef(sec->Name); } else { - const MachOFormat::Section *sec = getSection(DRI); + const MachOFormat::Section *sec = getSection(DRI); return ArrayRef(sec->Name); } } @@ -543,10 +561,10 @@ error_code MachOObjectFile::getSectionName(DataRefImpl DRI, ArrayRef MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const { if (is64Bit()) { - const MachOFormat::Section64 *sec = getSection64(Sec); + const MachOFormat::Section *sec = getSection64(Sec); return ArrayRef(sec->SegmentName, 16); } else { - const MachOFormat::Section *sec = getSection(Sec); + const MachOFormat::Section *sec = getSection(Sec); return ArrayRef(sec->SegmentName); } } @@ -559,10 +577,10 @@ StringRef MachOObjectFile::getSectionFinalSegmentName(DataRefImpl DRI) const { error_code MachOObjectFile::getSectionAddress(DataRefImpl DRI, uint64_t &Result) const { if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(DRI); + const MachOFormat::Section *Sect = getSection64(DRI); Result = Sect->Address; } else { - const MachOFormat::Section *Sect = getSection(DRI); + const MachOFormat::Section *Sect = getSection(DRI); Result = Sect->Address; } return object_error::success; @@ -571,10 +589,10 @@ error_code MachOObjectFile::getSectionAddress(DataRefImpl DRI, error_code MachOObjectFile::getSectionSize(DataRefImpl DRI, uint64_t &Result) const { if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(DRI); + const MachOFormat::Section *Sect = getSection64(DRI); Result = Sect->Size; } else { - const MachOFormat::Section *Sect = getSection(DRI); + const MachOFormat::Section *Sect = getSection(DRI); Result = Sect->Size; } return object_error::success; @@ -583,10 +601,10 @@ error_code MachOObjectFile::getSectionSize(DataRefImpl DRI, error_code MachOObjectFile::getSectionContents(DataRefImpl DRI, StringRef &Result) const { if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(DRI); + const MachOFormat::Section *Sect = getSection64(DRI); Result = getData(Sect->Offset, Sect->Size); } else { - const MachOFormat::Section *Sect = getSection(DRI); + const MachOFormat::Section *Sect = getSection(DRI); Result = getData(Sect->Offset, Sect->Size); } return object_error::success; @@ -595,10 +613,10 @@ error_code MachOObjectFile::getSectionContents(DataRefImpl DRI, error_code MachOObjectFile::getSectionAlignment(DataRefImpl DRI, uint64_t &Result) const { if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(DRI); + const MachOFormat::Section *Sect = getSection64(DRI); Result = uint64_t(1) << Sect->Align; } else { - const MachOFormat::Section *Sect = getSection(DRI); + const MachOFormat::Section *Sect = getSection(DRI); Result = uint64_t(1) << Sect->Align; } return object_error::success; @@ -607,10 +625,10 @@ error_code MachOObjectFile::getSectionAlignment(DataRefImpl DRI, error_code MachOObjectFile::isSectionText(DataRefImpl DRI, bool &Result) const { if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(DRI); + const MachOFormat::Section *Sect = getSection64(DRI); Result = Sect->Flags & macho::SF_PureInstructions; } else { - const MachOFormat::Section *Sect = getSection(DRI); + const MachOFormat::Section *Sect = getSection(DRI); Result = Sect->Flags & macho::SF_PureInstructions; } return object_error::success; @@ -647,12 +665,12 @@ error_code MachOObjectFile::isSectionVirtual(DataRefImpl Sec, error_code MachOObjectFile::isSectionZeroInit(DataRefImpl DRI, bool &Result) const { if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(DRI); + const MachOFormat::Section *Sect = getSection64(DRI); unsigned SectionType = Sect->Flags & MachO::SectionFlagMaskSectionType; Result = (SectionType == MachO::SectionTypeZeroFill || SectionType == MachO::SectionTypeZeroFillLarge); } else { - const MachOFormat::Section *Sect = getSection(DRI); + const MachOFormat::Section *Sect = getSection(DRI); unsigned SectionType = Sect->Flags & MachO::SectionFlagMaskSectionType; Result = (SectionType == MachO::SectionTypeZeroFill || SectionType == MachO::SectionTypeZeroFillLarge); @@ -688,11 +706,13 @@ error_code MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec, SectEnd += SectBegin; if (is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(Symb); + const MachOFormat::SymbolTableEntry *Entry = + getSymbol64TableEntry(Symb); uint64_t SymAddr= Entry->Value; Result = (SymAddr >= SectBegin) && (SymAddr < SectEnd); } else { - const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(Symb); + const MachOFormat::SymbolTableEntry *Entry = + getSymbolTableEntry(Symb); uint64_t SymAddr= Entry->Value; Result = (SymAddr >= SectBegin) && (SymAddr < SectEnd); } @@ -705,13 +725,14 @@ relocation_iterator MachOObjectFile::getSectionRelBegin(DataRefImpl Sec) const { ret.d.b = getSectionIndex(Sec); return relocation_iterator(RelocationRef(ret, this)); } + relocation_iterator MachOObjectFile::getSectionRelEnd(DataRefImpl Sec) const { uint32_t last_reloc; if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(Sec); + const MachOFormat::Section *Sect = getSection64(Sec); last_reloc = Sect->NumRelocationTableEntries; } else { - const MachOFormat::Section *Sect = getSection(Sec); + const MachOFormat::Section *Sect = getSection(Sec); last_reloc = Sect->NumRelocationTableEntries; } DataRefImpl ret; @@ -738,10 +759,10 @@ const MachOFormat::RelocationEntry * MachOObjectFile::getRelocation(DataRefImpl Rel) const { uint32_t relOffset; if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(Sections[Rel.d.b]); + const MachOFormat::Section *Sect = getSection64(Sections[Rel.d.b]); relOffset = Sect->RelocationTableOffset; } else { - const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]); + const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]); relOffset = Sect->RelocationTableOffset; } uint64_t Offset = relOffset + Rel.d.a * sizeof(MachOFormat::RelocationEntry); @@ -759,10 +780,10 @@ error_code MachOObjectFile::getRelocationAddress(DataRefImpl Rel, uint64_t &Res) const { const uint8_t* sectAddress = 0; if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(Sections[Rel.d.b]); + const MachOFormat::Section *Sect = getSection64(Sections[Rel.d.b]); sectAddress += Sect->Address; } else { - const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]); + const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]); sectAddress += Sect->Address; } const MachOFormat::RelocationEntry *RE = getRelocation(Rel); @@ -926,10 +947,10 @@ error_code MachOObjectFile::getRelocationAdditionalInfo(DataRefImpl Rel, if (!isExtern) { const uint8_t* sectAddress = base(); if (is64Bit()) { - const MachOFormat::Section64 *Sect = getSection64(Sections[Rel.d.b]); + const MachOFormat::Section *Sect = getSection64(Sections[Rel.d.b]); sectAddress += Sect->Offset; } else { - const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]); + const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]); sectAddress += Sect->Offset; } Res = reinterpret_cast(sectAddress); diff --git a/tools/llvm-readobj/MachODumper.cpp b/tools/llvm-readobj/MachODumper.cpp index 190baa229b5..89402808bfe 100644 --- a/tools/llvm-readobj/MachODumper.cpp +++ b/tools/llvm-readobj/MachODumper.cpp @@ -161,7 +161,7 @@ static void getSection(const MachOObjectFile *Obj, DataRefImpl DRI, MachOSection &Section) { if (Obj->is64Bit()) { - const MachOFormat::Section64 *Sect = Obj->getSection64(DRI); + const MachOFormat::Section *Sect = Obj->getSection64(DRI); Section.Address = Sect->Address; Section.Size = Sect->Size; @@ -173,7 +173,7 @@ static void getSection(const MachOObjectFile *Obj, Section.Reserved1 = Sect->Reserved1; Section.Reserved2 = Sect->Reserved2; } else { - const MachOFormat::Section *Sect = Obj->getSection(DRI); + const MachOFormat::Section *Sect = Obj->getSection(DRI); Section.Address = Sect->Address; Section.Size = Sect->Size; @@ -191,15 +191,16 @@ static void getSymbol(const MachOObjectFile *Obj, DataRefImpl DRI, MachOSymbol &Symbol) { if (Obj->is64Bit()) { - const MachOFormat::Symbol64TableEntry *Entry = - Obj->getSymbol64TableEntry( DRI); + const MachOFormat::SymbolTableEntry *Entry = + Obj->getSymbol64TableEntry(DRI); Symbol.StringIndex = Entry->StringIndex; Symbol.Type = Entry->Type; Symbol.SectionIndex = Entry->SectionIndex; Symbol.Flags = Entry->Flags; Symbol.Value = Entry->Value; } else { - const MachOFormat::SymbolTableEntry *Entry = Obj->getSymbolTableEntry(DRI); + const MachOFormat::SymbolTableEntry *Entry = + Obj->getSymbolTableEntry(DRI); Symbol.StringIndex = Entry->StringIndex; Symbol.Type = Entry->Type; Symbol.SectionIndex = Entry->SectionIndex;