mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-12 14:17:59 +00:00
[llvm-readobj] Dump MachO Dysymtab command.
Example output: File: <stdin> Format: Mach-O 64-bit x86-64 Arch: x86_64 AddressSize: 64bit Dysymtab { ilocalsym: 0 nlocalsym: 6 iextdefsym: 6 nextdefsym: 2 iundefsym: 8 nundefsym: 0 tocoff: 0 ntoc: 0 modtaboff: 0 nmodtab: 0 extrefsymoff: 0 nextrefsyms: 0 indirectsymoff: 0 nindirectsyms: 0 extreloff: 0 nextrel: 0 locreloff: 0 nlocrel: 0 } Differential Revision: http://reviews.llvm.org/D12496 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
17ae20060e
commit
19c43a6286
@ -43,6 +43,7 @@ public:
|
||||
// MachO-specific.
|
||||
void printMachODataInCode() override;
|
||||
void printMachOVersionMin() override;
|
||||
void printMachODysymtab() override;
|
||||
|
||||
private:
|
||||
template<class MachHeader>
|
||||
@ -663,3 +664,30 @@ void MachODumper::printMachOVersionMin() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MachODumper::printMachODysymtab() {
|
||||
for (const auto &Load : Obj->load_commands()) {
|
||||
if (Load.C.cmd == MachO::LC_DYSYMTAB) {
|
||||
MachO::dysymtab_command DLC = Obj->getDysymtabLoadCommand();
|
||||
DictScope Group(W, "Dysymtab");
|
||||
W.printNumber("ilocalsym", DLC.ilocalsym);
|
||||
W.printNumber("nlocalsym", DLC.nlocalsym);
|
||||
W.printNumber("iextdefsym", DLC.iextdefsym);
|
||||
W.printNumber("nextdefsym", DLC.nextdefsym);
|
||||
W.printNumber("iundefsym", DLC.iundefsym);
|
||||
W.printNumber("nundefsym", DLC.nundefsym);
|
||||
W.printNumber("tocoff", DLC.tocoff);
|
||||
W.printNumber("ntoc", DLC.ntoc);
|
||||
W.printNumber("modtaboff", DLC.modtaboff);
|
||||
W.printNumber("nmodtab", DLC.nmodtab);
|
||||
W.printNumber("extrefsymoff", DLC.extrefsymoff);
|
||||
W.printNumber("nextrefsyms", DLC.nextrefsyms);
|
||||
W.printNumber("indirectsymoff", DLC.indirectsymoff);
|
||||
W.printNumber("nindirectsyms", DLC.nindirectsyms);
|
||||
W.printNumber("extreloff", DLC.extreloff);
|
||||
W.printNumber("nextrel", DLC.nextrel);
|
||||
W.printNumber("locreloff", DLC.locreloff);
|
||||
W.printNumber("nlocrel", DLC.nlocrel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
// Only implemented for MachO.
|
||||
virtual void printMachODataInCode() { }
|
||||
virtual void printMachOVersionMin() { }
|
||||
virtual void printMachODysymtab() { }
|
||||
|
||||
virtual void printStackMap() const = 0;
|
||||
|
||||
|
@ -191,6 +191,12 @@ namespace opts {
|
||||
cl::opt<bool>
|
||||
MachOVersionMin("macho-version-min",
|
||||
cl::desc("Display MachO version min command"));
|
||||
|
||||
// -macho-dysymtab
|
||||
cl::opt<bool>
|
||||
MachODysymtab("macho-dysymtab",
|
||||
cl::desc("Display MachO Dysymtab command"));
|
||||
|
||||
// -stackmap
|
||||
cl::opt<bool>
|
||||
PrintStackMap("stackmap",
|
||||
@ -327,6 +333,8 @@ static void dumpObject(const ObjectFile *Obj) {
|
||||
Dumper->printMachODataInCode();
|
||||
if (opts::MachOVersionMin)
|
||||
Dumper->printMachOVersionMin();
|
||||
if (opts::MachODysymtab)
|
||||
Dumper->printMachODysymtab();
|
||||
}
|
||||
if (opts::PrintStackMap)
|
||||
Dumper->printStackMap();
|
||||
|
Loading…
Reference in New Issue
Block a user