llvm.org GIT mirror llvm / 728b8cf
Add printing the LC_SUB_CLIENT load command with llvm-objdump’s -private-headers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224616 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
373373 getSubUmbrellaCommand(const LoadCommandInfo &L) const;
374374 MachO::sub_library_command
375375 getSubLibraryCommand(const LoadCommandInfo &L) const;
376 MachO::sub_client_command
377 getSubClientCommand(const LoadCommandInfo &L) const;
376378
377379 MachO::any_relocation_info getRelocation(DataRefImpl Rel) const;
378380 MachO::data_in_code_entry getDice(DataRefImpl Rel) const;
11241124 sys::swapByteOrder(s.sub_library);
11251125 }
11261126
1127 inline void swapStruct(sub_client_command &s) {
1128 sys::swapByteOrder(s.cmd);
1129 sys::swapByteOrder(s.cmdsize);
1130 sys::swapByteOrder(s.client);
1131 }
1132
11271133 inline void swapStruct(dylinker_command &d) {
11281134 sys::swapByteOrder(d.cmd);
11291135 sys::swapByteOrder(d.cmdsize);
23262326 return getStruct(this, L.Ptr);
23272327 }
23282328
2329 MachO::sub_client_command
2330 MachOObjectFile::getSubClientCommand(const LoadCommandInfo &L) const {
2331 return getStruct(this, L.Ptr);
2332 }
2333
23292334 MachO::any_relocation_info
23302335 MachOObjectFile::getRelocation(DataRefImpl Rel) const {
23312336 DataRefImpl Sec;
1010 // RUN: | FileCheck %s -check-prefix=SUB_UMB
1111 // RUN: llvm-objdump -p %p/Inputs/dylibSubLibrary.macho-x86_64 \
1212 // RUN: | FileCheck %s -check-prefix=SUB_LIB
13 // RUN: llvm-objdump -p %p/Inputs/dylibSubClient.macho-x86_64 \
14 // RUN: | FileCheck %s -check-prefix=SUB_CLI
1315
1416 CHECK: Mach header
1517 CHECK: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
399401 SUB_LIB: cmd LC_SUB_LIBRARY
400402 SUB_LIB: cmdsize 20
401403 SUB_LIB: sub_library libfoo (offset 12)
404
405 SUB_CLI: Load command 10
406 SUB_CLI: cmd LC_SUB_CLIENT
407 SUB_CLI: cmdsize 16
408 SUB_CLI: client bar (offset 12)
37213721 }
37223722 }
37233723
3724 static void PrintSubClientCommand(MachO::sub_client_command sub,
3725 const char *Ptr) {
3726 outs() << " cmd LC_SUB_CLIENT\n";
3727 outs() << " cmdsize " << sub.cmdsize;
3728 if (sub.cmdsize < sizeof(struct MachO::sub_client_command))
3729 outs() << " Incorrect size\n";
3730 else
3731 outs() << "\n";
3732 if (sub.client < sub.cmdsize) {
3733 const char *P = Ptr + sub.client;
3734 outs() << " client " << P << " (offset " << sub.client << ")\n";
3735 } else {
3736 outs() << " client ?(bad offset " << sub.client << ")\n";
3737 }
3738 }
37243739
37253740 static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
37263741 if (dl.cmd == MachO::LC_ID_DYLIB)
38873902 } else if (Command.C.cmd == MachO::LC_SUB_LIBRARY) {
38883903 MachO::sub_library_command Sl = Obj->getSubLibraryCommand(Command);
38893904 PrintSubLibraryCommand(Sl, Command.Ptr);
3905 } else if (Command.C.cmd == MachO::LC_SUB_CLIENT) {
3906 MachO::sub_client_command Sc = Obj->getSubClientCommand(Command);
3907 PrintSubClientCommand(Sc, Command.Ptr);
38903908 } else if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
38913909 Command.C.cmd == MachO::LC_ID_DYLIB ||
38923910 Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||