From f16c2bb320f4d5b33dfaf8df8865f547e6d66005 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 5 Apr 2013 15:15:22 +0000 Subject: Don't fetch pointers from a InMemoryStruct. InMemoryStruct is extremely dangerous as it returns data from an internal buffer when the endiannes doesn't match. This should fix the tests on big endian hosts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178875 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-objdump/MachODump.cpp | 5 ++--- tools/llvm-objdump/llvm-objdump.cpp | 7 ++----- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'tools/llvm-objdump') diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index c324ff13a6..e9d2b3b1a8 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -337,10 +337,9 @@ void llvm::DisassembleInputMachO(StringRef Filename) { SectName != "__text") continue; // Skip non-text sections - StringRef SegmentName; DataRefImpl DR = Sections[SectIdx].getRawDataRefImpl(); - if (MachOOF->getSectionFinalSegmentName(DR, SegmentName) || - SegmentName != "__TEXT") + StringRef SegmentName = MachOOF->getSectionFinalSegmentName(DR); + if (SegmentName != "__TEXT") continue; // Insert the functions from the function starts segment into our map. diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 7832cf0dff..9a36e8253d 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -257,8 +257,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { StringRef SegmentName = ""; if (const MachOObjectFile *MachO = dyn_cast(Obj)) { DataRefImpl DR = i->getRawDataRefImpl(); - if (error(MachO->getSectionFinalSegmentName(DR, SegmentName))) - break; + SegmentName = MachO->getSectionFinalSegmentName(DR); } StringRef name; if (error(i->getName(name))) break; @@ -593,10 +592,8 @@ static void PrintSymbolTable(const ObjectFile *o) { outs() << "*UND*"; else { if (const MachOObjectFile *MachO = dyn_cast(o)) { - StringRef SegmentName; DataRefImpl DR = Section->getRawDataRefImpl(); - if (error(MachO->getSectionFinalSegmentName(DR, SegmentName))) - SegmentName = ""; + StringRef SegmentName = MachO->getSectionFinalSegmentName(DR); outs() << SegmentName << ","; } StringRef SectionName; -- cgit v1.2.3