llvm.org GIT mirror llvm / 7ab2009
[llvm-readobj] Dump MachO indirect symbols. Example output: File: <stdin> Format: Mach-O 32-bit i386 Arch: i386 AddressSize: 32bit Indirect Symbols { Number: 3 Symbols [ Entry { Entry Index: 0 Symbol Index: 0x4 } Entry { Entry Index: 1 Symbol Index: 0x0 } Entry { Entry Index: 2 Symbol Index: 0x1 } ] } Differential Revision: http://reviews.llvm.org/D12570 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246789 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 5 years ago
3 changed file(s) with 25 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
4444 void printMachOVersionMin() override;
4545 void printMachODysymtab() override;
4646 void printMachOSegment() override;
47 void printMachOIndirectSymbols() override;
4748
4849 private:
4950 template
773774 }
774775 }
775776 }
777
778 void MachODumper::printMachOIndirectSymbols() {
779 for (const auto &Load : Obj->load_commands()) {
780 if (Load.C.cmd == MachO::LC_DYSYMTAB) {
781 MachO::dysymtab_command DLC = Obj->getDysymtabLoadCommand();
782 DictScope Group(W, "Indirect Symbols");
783 W.printNumber("Number", DLC.nindirectsyms);
784 ListScope D(W, "Symbols");
785 for (unsigned i = 0; i < DLC.nindirectsyms; ++i) {
786 DictScope Group(W, "Entry");
787 W.printNumber("Entry Index", i);
788 W.printHex("Symbol Index", Obj->getIndirectSymbolTableEntry(DLC, i));
789 }
790 }
791 }
792 }
5959 virtual void printMachOVersionMin() { }
6060 virtual void printMachODysymtab() { }
6161 virtual void printMachOSegment() { }
62 virtual void printMachOIndirectSymbols() { }
6263
6364 virtual void printStackMap() const = 0;
6465
185185 cl::opt
186186 MachODataInCode("macho-data-in-code",
187187 cl::desc("Display MachO Data in Code command"));
188
189 // -macho-indirect-symbols
190 cl::opt
191 MachOIndirectSymbols("macho-indirect-symbols",
192 cl::desc("Display MachO indirect symbols"));
188193
189194 // -macho-segment
190195 cl::opt
335340 if (Obj->isMachO()) {
336341 if (opts::MachODataInCode)
337342 Dumper->printMachODataInCode();
343 if (opts::MachOIndirectSymbols)
344 Dumper->printMachOIndirectSymbols();
338345 if (opts::MachOSegment)
339346 Dumper->printMachOSegment();
340347 if (opts::MachOVersionMin)