llvm.org GIT mirror llvm / 19c43a6
[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 Davide Italiano 5 years ago
3 changed file(s) with 37 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4242 // MachO-specific.
4343 void printMachODataInCode() override;
4444 void printMachOVersionMin() override;
45 void printMachODysymtab() override;
4546
4647 private:
4748 template
662663 }
663664 }
664665 }
666
667 void MachODumper::printMachODysymtab() {
668 for (const auto &Load : Obj->load_commands()) {
669 if (Load.C.cmd == MachO::LC_DYSYMTAB) {
670 MachO::dysymtab_command DLC = Obj->getDysymtabLoadCommand();
671 DictScope Group(W, "Dysymtab");
672 W.printNumber("ilocalsym", DLC.ilocalsym);
673 W.printNumber("nlocalsym", DLC.nlocalsym);
674 W.printNumber("iextdefsym", DLC.iextdefsym);
675 W.printNumber("nextdefsym", DLC.nextdefsym);
676 W.printNumber("iundefsym", DLC.iundefsym);
677 W.printNumber("nundefsym", DLC.nundefsym);
678 W.printNumber("tocoff", DLC.tocoff);
679 W.printNumber("ntoc", DLC.ntoc);
680 W.printNumber("modtaboff", DLC.modtaboff);
681 W.printNumber("nmodtab", DLC.nmodtab);
682 W.printNumber("extrefsymoff", DLC.extrefsymoff);
683 W.printNumber("nextrefsyms", DLC.nextrefsyms);
684 W.printNumber("indirectsymoff", DLC.indirectsymoff);
685 W.printNumber("nindirectsyms", DLC.nindirectsyms);
686 W.printNumber("extreloff", DLC.extreloff);
687 W.printNumber("nextrel", DLC.nextrel);
688 W.printNumber("locreloff", DLC.locreloff);
689 W.printNumber("nlocrel", DLC.nlocrel);
690 }
691 }
692 }
5757 // Only implemented for MachO.
5858 virtual void printMachODataInCode() { }
5959 virtual void printMachOVersionMin() { }
60 virtual void printMachODysymtab() { }
6061
6162 virtual void printStackMap() const = 0;
6263
190190 cl::opt
191191 MachOVersionMin("macho-version-min",
192192 cl::desc("Display MachO version min command"));
193
194 // -macho-dysymtab
195 cl::opt
196 MachODysymtab("macho-dysymtab",
197 cl::desc("Display MachO Dysymtab command"));
198
193199 // -stackmap
194200 cl::opt
195201 PrintStackMap("stackmap",
326332 Dumper->printMachODataInCode();
327333 if (opts::MachOVersionMin)
328334 Dumper->printMachOVersionMin();
335 if (opts::MachODysymtab)
336 Dumper->printMachODysymtab();
329337 }
330338 if (opts::PrintStackMap)
331339 Dumper->printStackMap();