llvm.org GIT mirror llvm / 604a34e
Add printing the LC_SUB_UMBRELLA load command with llvm-objdump’s -private-headers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224548 91177308-0d34-0410-b5e6-96231b3b80d8 Kevin Enderby 5 years ago
6 changed file(s) with 39 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
369369 getEncryptionInfoCommand64(const LoadCommandInfo &L) const;
370370 MachO::sub_framework_command
371371 getSubFrameworkCommand(const LoadCommandInfo &L) const;
372 MachO::sub_umbrella_command
373 getSubUmbrellaCommand(const LoadCommandInfo &L) const;
372374
373375 MachO::any_relocation_info getRelocation(DataRefImpl Rel) const;
374376 MachO::data_in_code_entry getDice(DataRefImpl Rel) const;
11121112 sys::swapByteOrder(s.umbrella);
11131113 }
11141114
1115 inline void swapStruct(sub_umbrella_command &s) {
1116 sys::swapByteOrder(s.cmd);
1117 sys::swapByteOrder(s.cmdsize);
1118 sys::swapByteOrder(s.sub_umbrella);
1119 };
1120
11151121 inline void swapStruct(dylinker_command &d) {
11161122 sys::swapByteOrder(d.cmd);
11171123 sys::swapByteOrder(d.cmdsize);
23132313 return getStruct(this, L.Ptr);
23142314 }
23152315
2316 MachO::sub_umbrella_command
2317 MachOObjectFile::getSubUmbrellaCommand(const LoadCommandInfo &L) const {
2318 return getStruct(this, L.Ptr);
2319 }
2320
23162321 MachO::any_relocation_info
23172322 MachOObjectFile::getRelocation(DataRefImpl Rel) const {
23182323 DataRefImpl Sec;
66 // RUN: | FileCheck %s -check-prefix=LD_OPT
77 // RUN: llvm-objdump -p %p/Inputs/dylibSubFramework.macho-x86_64 \
88 // RUN: | FileCheck %s -check-prefix=SUB_FRAME
9 // RUN: llvm-objdump -p %p/Inputs/dylibSubUmbrella.macho-x86_64 \
10 // RUN: | FileCheck %s -check-prefix=SUB_UMB
911
1012 CHECK: Mach header
1113 CHECK: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
385387 SUB_FRAME: cmd LC_SUB_FRAMEWORK
386388 SUB_FRAME: cmdsize 16
387389 SUB_FRAME: umbrella Bar (offset 12)
390
391 SUB_UMB: Load command 5
392 SUB_UMB: cmd LC_SUB_UMBRELLA
393 SUB_UMB: cmdsize 16
394 SUB_UMB: sub_umbrella Foo (offset 12)
36893689 }
36903690 }
36913691
3692 static void PrintSubUmbrellaCommand(MachO::sub_umbrella_command sub,
3693 const char *Ptr) {
3694 outs() << " cmd LC_SUB_UMBRELLA\n";
3695 outs() << " cmdsize " << sub.cmdsize;
3696 if (sub.cmdsize < sizeof(struct MachO::sub_umbrella_command))
3697 outs() << " Incorrect size\n";
3698 else
3699 outs() << "\n";
3700 if (sub.sub_umbrella < sub.cmdsize) {
3701 const char *P = Ptr + sub.sub_umbrella;
3702 outs() << " sub_umbrella " << P << " (offset " << sub.sub_umbrella << ")\n";
3703 } else {
3704 outs() << " sub_umbrella ?(bad offset " << sub.sub_umbrella << ")\n";
3705 }
3706 }
3707
36923708 static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
36933709 if (dl.cmd == MachO::LC_ID_DYLIB)
36943710 outs() << " cmd LC_ID_DYLIB\n";
38483864 } else if (Command.C.cmd == MachO::LC_SUB_FRAMEWORK) {
38493865 MachO::sub_framework_command Sf = Obj->getSubFrameworkCommand(Command);
38503866 PrintSubFrameworkCommand(Sf, Command.Ptr);
3867 } else if (Command.C.cmd == MachO::LC_SUB_UMBRELLA) {
3868 MachO::sub_umbrella_command Sf = Obj->getSubUmbrellaCommand(Command);
3869 PrintSubUmbrellaCommand(Sf, Command.Ptr);
38513870 } else if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
38523871 Command.C.cmd == MachO::LC_ID_DYLIB ||
38533872 Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||