aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-objdump/MachODump.cpp
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-02-11 20:01:10 -0800
committerStephen Hines <srhines@google.com>2014-02-11 20:01:10 -0800
commitce9904c6ea8fd669978a8eefb854b330eb9828ff (patch)
tree2418ee2e96ea220977c8fb74959192036ab5b133 /tools/llvm-objdump/MachODump.cpp
parentc27b10b198c1d9e9b51f2303994313ec2778edd7 (diff)
parentdbb832b83351cec97b025b61c26536ef50c3181c (diff)
downloadexternal_llvm-ce9904c6ea8fd669978a8eefb854b330eb9828ff.zip
external_llvm-ce9904c6ea8fd669978a8eefb854b330eb9828ff.tar.gz
external_llvm-ce9904c6ea8fd669978a8eefb854b330eb9828ff.tar.bz2
Merge remote-tracking branch 'upstream/release_34' into merge-20140211
Conflicts: lib/Linker/LinkModules.cpp lib/Support/Unix/Signals.inc Change-Id: Ia54f291fa5dc828052d2412736e8495c1282aa64
Diffstat (limited to 'tools/llvm-objdump/MachODump.cpp')
-rw-r--r--tools/llvm-objdump/MachODump.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp
index e0ec9cc..86923fd 100644
--- a/tools/llvm-objdump/MachODump.cpp
+++ b/tools/llvm-objdump/MachODump.cpp
@@ -104,7 +104,7 @@ static void DumpDataInCode(const char *bytes, uint64_t Size,
uint64_t Value;
switch (Kind) {
- case macho::Data:
+ case MachO::DICE_KIND_DATA:
switch (Size) {
case 4:
Value = bytes[3] << 24 |
@@ -125,16 +125,16 @@ static void DumpDataInCode(const char *bytes, uint64_t Size,
}
outs() << "\t@ KIND_DATA\n";
break;
- case macho::JumpTable8:
+ case MachO::DICE_KIND_JUMP_TABLE8:
Value = bytes[0];
outs() << "\t.byte " << Value << "\t@ KIND_JUMP_TABLE8";
break;
- case macho::JumpTable16:
+ case MachO::DICE_KIND_JUMP_TABLE16:
Value = bytes[1] << 8 |
bytes[0];
outs() << "\t.short " << Value << "\t@ KIND_JUMP_TABLE16";
break;
- case macho::JumpTable32:
+ case MachO::DICE_KIND_JUMP_TABLE32:
Value = bytes[3] << 24 |
bytes[2] << 16 |
bytes[1] << 8 |
@@ -148,7 +148,7 @@ static void DumpDataInCode(const char *bytes, uint64_t Size,
}
static void
-getSectionsAndSymbols(const macho::Header Header,
+getSectionsAndSymbols(const MachO::mach_header Header,
MachOObjectFile *MachOObj,
std::vector<SectionRef> &Sections,
std::vector<SymbolRef> &Symbols,
@@ -171,25 +171,25 @@ getSectionsAndSymbols(const macho::Header Header,
MachOObj->getFirstLoadCommandInfo();
bool BaseSegmentAddressSet = false;
for (unsigned i = 0; ; ++i) {
- if (Command.C.Type == macho::LCT_FunctionStarts) {
+ if (Command.C.cmd == MachO::LC_FUNCTION_STARTS) {
// We found a function starts segment, parse the addresses for later
// consumption.
- macho::LinkeditDataLoadCommand LLC =
+ MachO::linkedit_data_command LLC =
MachOObj->getLinkeditDataLoadCommand(Command);
- MachOObj->ReadULEB128s(LLC.DataOffset, FoundFns);
+ MachOObj->ReadULEB128s(LLC.dataoff, FoundFns);
}
- else if (Command.C.Type == macho::LCT_Segment) {
- macho::SegmentLoadCommand SLC =
+ else if (Command.C.cmd == MachO::LC_SEGMENT) {
+ MachO::segment_command SLC =
MachOObj->getSegmentLoadCommand(Command);
- StringRef SegName = SLC.Name;
+ StringRef SegName = SLC.segname;
if(!BaseSegmentAddressSet && SegName != "__PAGEZERO") {
BaseSegmentAddressSet = true;
- BaseSegmentAddress = SLC.VMAddress;
+ BaseSegmentAddress = SLC.vmaddr;
}
}
- if (i == Header.NumLoadCommands - 1)
+ if (i == Header.ncmds - 1)
break;
else
Command = MachOObj->getNextLoadCommandInfo(Command);
@@ -244,7 +244,7 @@ static void DisassembleInputMachO2(StringRef Filename,
outs() << '\n' << Filename << ":\n\n";
- macho::Header Header = MachOOF->getHeader();
+ MachO::mach_header Header = MachOOF->getHeader();
// FIXME: FoundFns isn't used anymore. Using symbols/LC_FUNCTION_STARTS to
// determine function locations will eventually go in MCObjectDisassembler.
@@ -260,14 +260,12 @@ static void DisassembleInputMachO2(StringRef Filename,
getSectionsAndSymbols(Header, MachOOF, Sections, Symbols, FoundFns,
BaseSegmentAddress);
- // Make a copy of the unsorted symbol list. FIXME: duplication
- std::vector<SymbolRef> UnsortedSymbols(Symbols);
// Sort the symbols by address, just in case they didn't come in that way.
std::sort(Symbols.begin(), Symbols.end(), SymbolSorter());
// Build a data in code table that is sorted on by the address of each entry.
uint64_t BaseAddress = 0;
- if (Header.FileType == macho::HFT_Object)
+ if (Header.filetype == MachO::MH_OBJECT)
Sections[0].getAddress(BaseAddress);
else
BaseAddress = BaseSegmentAddress;