llvm.org GIT mirror llvm / 46a81fd
Add printing the LC_ENCRYPTION_INFO load command with llvm-objdump’s -private-headers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224390 91177308-0d34-0410-b5e6-96231b3b80d8 Kevin Enderby 5 years ago
5 changed file(s) with 44 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
363363 getSourceVersionCommand(const LoadCommandInfo &L) const;
364364 MachO::entry_point_command
365365 getEntryPointCommand(const LoadCommandInfo &L) const;
366 MachO::encryption_info_command
367 getEncryptionInfoCommand(const LoadCommandInfo &L) const;
366368
367369 MachO::any_relocation_info getRelocation(DataRefImpl Rel) const;
368370 MachO::data_in_code_entry getDice(DataRefImpl Rel) const;
11271127 sys::swapByteOrder(e.stacksize);
11281128 }
11291129
1130 inline void swapStruct(encryption_info_command &e) {
1131 sys::swapByteOrder(e.cmd);
1132 sys::swapByteOrder(e.cmdsize);
1133 sys::swapByteOrder(e.cryptoff);
1134 sys::swapByteOrder(e.cryptsize);
1135 sys::swapByteOrder(e.cryptid);
1136 }
1137
11301138 inline void swapStruct(dysymtab_command &dst) {
11311139 sys::swapByteOrder(dst.cmd);
11321140 sys::swapByteOrder(dst.cmdsize);
22982298 return getStruct(this, L.Ptr);
22992299 }
23002300
2301 MachO::encryption_info_command
2302 MachOObjectFile::getEncryptionInfoCommand(const LoadCommandInfo &L) const {
2303 return getStruct(this, L.Ptr);
2304 }
2305
23012306
23022307 MachO::any_relocation_info
23032308 MachOObjectFile::getRelocation(DataRefImpl Rel) const {
316316 EXE: entryoff 32645
317317 EXE: stacksize 0
318318 EXE: Load command 12
319 EXE: cmd LC_ENCRYPTION_INFO
320 EXE: cmdsize 20
321 EXE: cryptoff 16384
322 EXE: cryptsize 16384
323 EXE: cryptid 0
319324 EXE: Load command 13
320325 EXE: cmd LC_LOAD_DYLIB
321326 EXE: cmdsize 52
36003600 outs() << " stacksize " << ep.stacksize << "\n";
36013601 }
36023602
3603 static void PrintEncryptionInfoCommand(MachO::encryption_info_command ec,
3604 uint32_t object_size) {
3605 outs() << " cmd LC_ENCRYPTION_INFO\n";
3606 outs() << " cmdsize " << ec.cmdsize;
3607 if (ec.cmdsize != sizeof(struct MachO::encryption_info_command))
3608 outs() << " Incorrect size\n";
3609 else
3610 outs() << "\n";
3611 outs() << " cryptoff " << ec.cryptoff;
3612 if (ec.cryptoff > object_size)
3613 outs() << " (past end of file)\n";
3614 else
3615 outs() << "\n";
3616 outs() << " cryptsize " << ec.cryptsize;
3617 if (ec.cryptsize > object_size)
3618 outs() << " (past end of file)\n";
3619 else
3620 outs() << "\n";
3621 outs() << " cryptid " << ec.cryptid << "\n";
3622 }
3623
36033624 static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
36043625 if (dl.cmd == MachO::LC_ID_DYLIB)
36053626 outs() << " cmd LC_ID_DYLIB\n";
37473768 } else if (Command.C.cmd == MachO::LC_MAIN) {
37483769 MachO::entry_point_command Ep = Obj->getEntryPointCommand(Command);
37493770 PrintEntryPointCommand(Ep);
3771 } else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO) {
3772 MachO::encryption_info_command Ei = Obj->getEncryptionInfoCommand(Command);
3773 PrintEncryptionInfoCommand(Ei, Buf.size());
37503774 } else if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
37513775 Command.C.cmd == MachO::LC_ID_DYLIB ||
37523776 Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||