llvm.org GIT mirror llvm / a42da31
Add printing the LC_SUB_FRAMEWORK load command with llvm-objdump’s -private-headers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224534 91177308-0d34-0410-b5e6-96231b3b80d8 Kevin Enderby 5 years ago
6 changed file(s) with 38 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
367367 getEncryptionInfoCommand(const LoadCommandInfo &L) const;
368368 MachO::encryption_info_command_64
369369 getEncryptionInfoCommand64(const LoadCommandInfo &L) const;
370 MachO::sub_framework_command
371 getSubFrameworkCommand(const LoadCommandInfo &L) const;
370372
371373 MachO::any_relocation_info getRelocation(DataRefImpl Rel) const;
372374 MachO::data_in_code_entry getDice(DataRefImpl Rel) const;
11061106 sys::swapByteOrder(d.dylib.compatibility_version);
11071107 }
11081108
1109 inline void swapStruct(sub_framework_command &s) {
1110 sys::swapByteOrder(s.cmd);
1111 sys::swapByteOrder(s.cmdsize);
1112 sys::swapByteOrder(s.umbrella);
1113 };
1114
11091115 inline void swapStruct(dylinker_command &d) {
11101116 sys::swapByteOrder(d.cmd);
11111117 sys::swapByteOrder(d.cmdsize);
23082308 return getStruct(this, L.Ptr);
23092309 }
23102310
2311 MachO::sub_framework_command
2312 MachOObjectFile::getSubFrameworkCommand(const LoadCommandInfo &L) const {
2313 return getStruct(this, L.Ptr);
2314 }
23112315
23122316 MachO::any_relocation_info
23132317 MachOObjectFile::getRelocation(DataRefImpl Rel) const {
44 // RUN: | FileCheck %s -check-prefix=LOAD
55 // RUN: llvm-objdump -p %p/Inputs/linkerOption.macho-x86_64 \
66 // RUN: | FileCheck %s -check-prefix=LD_OPT
7 // RUN: llvm-objdump -p %p/Inputs/dylibSubFramework.macho-x86_64 \
8 // RUN: | FileCheck %s -check-prefix=SUB_FRAME
79
810 CHECK: Mach header
911 CHECK: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
378380 LD_OPT: count 2
379381 LD_OPT: string #1 -framework
380382 LD_OPT: string #2 Foundation
383
384 SUB_FRAME: Load command 10
385 SUB_FRAME: cmd LC_SUB_FRAMEWORK
386 SUB_FRAME: cmdsize 16
387 SUB_FRAME: umbrella Bar (offset 12)
36733673 << "\n";
36743674 }
36753675
3676 static void PrintSubFrameworkCommand(MachO::sub_framework_command sub,
3677 const char *Ptr) {
3678 outs() << " cmd LC_SUB_FRAMEWORK\n";
3679 outs() << " cmdsize " << sub.cmdsize;
3680 if (sub.cmdsize < sizeof(struct MachO::sub_framework_command))
3681 outs() << " Incorrect size\n";
3682 else
3683 outs() << "\n";
3684 if (sub.umbrella < sub.cmdsize) {
3685 const char *P = Ptr + sub.umbrella;
3686 outs() << " umbrella " << P << " (offset " << sub.umbrella << ")\n";
3687 } else {
3688 outs() << " umbrella ?(bad offset " << sub.umbrella << ")\n";
3689 }
3690 }
3691
36763692 static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
36773693 if (dl.cmd == MachO::LC_ID_DYLIB)
36783694 outs() << " cmd LC_ID_DYLIB\n";
38293845 } else if (Command.C.cmd == MachO::LC_LINKER_OPTION) {
38303846 MachO::linker_option_command Lo = Obj->getLinkerOptionLoadCommand(Command);
38313847 PrintLinkerOptionCommand(Lo, Command.Ptr);
3848 } else if (Command.C.cmd == MachO::LC_SUB_FRAMEWORK) {
3849 MachO::sub_framework_command Sf = Obj->getSubFrameworkCommand(Command);
3850 PrintSubFrameworkCommand(Sf, Command.Ptr);
38323851 } else if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
38333852 Command.C.cmd == MachO::LC_ID_DYLIB ||
38343853 Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||