1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Add printing the LC_ENCRYPTION_INFO load command with llvm-objdump’s -private-headers.

llvm-svn: 224390
This commit is contained in:
Kevin Enderby 2014-12-16 23:25:52 +00:00
parent 4efb9deca4
commit c4d55fc277
5 changed files with 44 additions and 0 deletions

View File

@ -364,6 +364,8 @@ public:
getSourceVersionCommand(const LoadCommandInfo &L) const;
MachO::entry_point_command
getEntryPointCommand(const LoadCommandInfo &L) const;
MachO::encryption_info_command
getEncryptionInfoCommand(const LoadCommandInfo &L) const;
MachO::any_relocation_info getRelocation(DataRefImpl Rel) const;
MachO::data_in_code_entry getDice(DataRefImpl Rel) const;

View File

@ -1128,6 +1128,14 @@ namespace llvm {
sys::swapByteOrder(e.stacksize);
}
inline void swapStruct(encryption_info_command &e) {
sys::swapByteOrder(e.cmd);
sys::swapByteOrder(e.cmdsize);
sys::swapByteOrder(e.cryptoff);
sys::swapByteOrder(e.cryptsize);
sys::swapByteOrder(e.cryptid);
}
inline void swapStruct(dysymtab_command &dst) {
sys::swapByteOrder(dst.cmd);
sys::swapByteOrder(dst.cmdsize);

View File

@ -2299,6 +2299,11 @@ MachOObjectFile::getEntryPointCommand(const LoadCommandInfo &L) const {
return getStruct<MachO::entry_point_command>(this, L.Ptr);
}
MachO::encryption_info_command
MachOObjectFile::getEncryptionInfoCommand(const LoadCommandInfo &L) const {
return getStruct<MachO::encryption_info_command>(this, L.Ptr);
}
MachO::any_relocation_info
MachOObjectFile::getRelocation(DataRefImpl Rel) const {

View File

@ -317,6 +317,11 @@ EXE: cmdsize 24
EXE: entryoff 32645
EXE: stacksize 0
EXE: Load command 12
EXE: cmd LC_ENCRYPTION_INFO
EXE: cmdsize 20
EXE: cryptoff 16384
EXE: cryptsize 16384
EXE: cryptid 0
EXE: Load command 13
EXE: cmd LC_LOAD_DYLIB
EXE: cmdsize 52

View File

@ -3601,6 +3601,27 @@ static void PrintEntryPointCommand(MachO::entry_point_command ep) {
outs() << " stacksize " << ep.stacksize << "\n";
}
static void PrintEncryptionInfoCommand(MachO::encryption_info_command ec,
uint32_t object_size) {
outs() << " cmd LC_ENCRYPTION_INFO\n";
outs() << " cmdsize " << ec.cmdsize;
if (ec.cmdsize != sizeof(struct MachO::encryption_info_command))
outs() << " Incorrect size\n";
else
outs() << "\n";
outs() << " cryptoff " << ec.cryptoff;
if (ec.cryptoff > object_size)
outs() << " (past end of file)\n";
else
outs() << "\n";
outs() << " cryptsize " << ec.cryptsize;
if (ec.cryptsize > object_size)
outs() << " (past end of file)\n";
else
outs() << "\n";
outs() << " cryptid " << ec.cryptid << "\n";
}
static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
if (dl.cmd == MachO::LC_ID_DYLIB)
outs() << " cmd LC_ID_DYLIB\n";
@ -3748,6 +3769,9 @@ static void PrintLoadCommands(const MachOObjectFile *Obj, uint32_t ncmds,
} else if (Command.C.cmd == MachO::LC_MAIN) {
MachO::entry_point_command Ep = Obj->getEntryPointCommand(Command);
PrintEntryPointCommand(Ep);
} else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO) {
MachO::encryption_info_command Ei = Obj->getEncryptionInfoCommand(Command);
PrintEncryptionInfoCommand(Ei, Buf.size());
} else if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
Command.C.cmd == MachO::LC_ID_DYLIB ||
Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||