From fd7aa38e304a09fa0ef51b85b773b649b7e58c5e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 18 Apr 2013 18:08:55 +0000 Subject: At Jim Grosbach's request detemplate Object/MachO.h. We are still able to handle mixed endian objects by swapping one struct at a time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179778 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-objdump/llvm-objdump.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'tools/llvm-objdump/llvm-objdump.cpp') diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 6f4b101c30..9985599565 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -191,14 +191,6 @@ bool llvm::RelocAddressLess(RelocationRef a, RelocationRef b) { return a_addr < b_addr; } -StringRef -getSectionFinalSegmentName(const MachOObjectFileBase *MachO, DataRefImpl DR) { - if (const MachOObjectFileLE *O = dyn_cast(MachO)) - return O->getSectionFinalSegmentName(DR); - const MachOObjectFileBE *O = dyn_cast(MachO); - return O->getSectionFinalSegmentName(DR); -} - static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { const Target *TheTarget = getTarget(Obj); // getTarget() will have already issued a diagnostic if necessary, so @@ -263,10 +255,10 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { std::sort(Rels.begin(), Rels.end(), RelocAddressLess); StringRef SegmentName = ""; - if (const MachOObjectFileBase *MachO = - dyn_cast(Obj)) { + if (const MachOObjectFile *MachO = + dyn_cast(Obj)) { DataRefImpl DR = i->getRawDataRefImpl(); - SegmentName = getSectionFinalSegmentName(MachO, DR); + SegmentName = MachO->getSectionFinalSegmentName(DR); } StringRef name; if (error(i->getName(name))) break; @@ -608,10 +600,10 @@ static void PrintSymbolTable(const ObjectFile *o) { else if (Section == o->end_sections()) outs() << "*UND*"; else { - if (const MachOObjectFileBase *MachO = - dyn_cast(o)) { + if (const MachOObjectFile *MachO = + dyn_cast(o)) { DataRefImpl DR = Section->getRawDataRefImpl(); - StringRef SegmentName = getSectionFinalSegmentName(MachO, DR); + StringRef SegmentName = MachO->getSectionFinalSegmentName(DR); outs() << SegmentName << ","; } StringRef SectionName; -- cgit v1.2.3-18-g5258