mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
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
This commit is contained in:
@@ -364,6 +364,8 @@ public:
|
|||||||
getSourceVersionCommand(const LoadCommandInfo &L) const;
|
getSourceVersionCommand(const LoadCommandInfo &L) const;
|
||||||
MachO::entry_point_command
|
MachO::entry_point_command
|
||||||
getEntryPointCommand(const LoadCommandInfo &L) const;
|
getEntryPointCommand(const LoadCommandInfo &L) const;
|
||||||
|
MachO::encryption_info_command
|
||||||
|
getEncryptionInfoCommand(const LoadCommandInfo &L) const;
|
||||||
|
|
||||||
MachO::any_relocation_info getRelocation(DataRefImpl Rel) const;
|
MachO::any_relocation_info getRelocation(DataRefImpl Rel) const;
|
||||||
MachO::data_in_code_entry getDice(DataRefImpl Rel) const;
|
MachO::data_in_code_entry getDice(DataRefImpl Rel) const;
|
||||||
|
|||||||
@@ -1128,6 +1128,14 @@ namespace llvm {
|
|||||||
sys::swapByteOrder(e.stacksize);
|
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) {
|
inline void swapStruct(dysymtab_command &dst) {
|
||||||
sys::swapByteOrder(dst.cmd);
|
sys::swapByteOrder(dst.cmd);
|
||||||
sys::swapByteOrder(dst.cmdsize);
|
sys::swapByteOrder(dst.cmdsize);
|
||||||
|
|||||||
@@ -2299,6 +2299,11 @@ MachOObjectFile::getEntryPointCommand(const LoadCommandInfo &L) const {
|
|||||||
return getStruct<MachO::entry_point_command>(this, L.Ptr);
|
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
|
MachO::any_relocation_info
|
||||||
MachOObjectFile::getRelocation(DataRefImpl Rel) const {
|
MachOObjectFile::getRelocation(DataRefImpl Rel) const {
|
||||||
|
|||||||
@@ -317,6 +317,11 @@ EXE: cmdsize 24
|
|||||||
EXE: entryoff 32645
|
EXE: entryoff 32645
|
||||||
EXE: stacksize 0
|
EXE: stacksize 0
|
||||||
EXE: Load command 12
|
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: Load command 13
|
||||||
EXE: cmd LC_LOAD_DYLIB
|
EXE: cmd LC_LOAD_DYLIB
|
||||||
EXE: cmdsize 52
|
EXE: cmdsize 52
|
||||||
|
|||||||
@@ -3601,6 +3601,27 @@ static void PrintEntryPointCommand(MachO::entry_point_command ep) {
|
|||||||
outs() << " stacksize " << ep.stacksize << "\n";
|
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) {
|
static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
|
||||||
if (dl.cmd == MachO::LC_ID_DYLIB)
|
if (dl.cmd == MachO::LC_ID_DYLIB)
|
||||||
outs() << " cmd LC_ID_DYLIB\n";
|
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) {
|
} else if (Command.C.cmd == MachO::LC_MAIN) {
|
||||||
MachO::entry_point_command Ep = Obj->getEntryPointCommand(Command);
|
MachO::entry_point_command Ep = Obj->getEntryPointCommand(Command);
|
||||||
PrintEntryPointCommand(Ep);
|
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 ||
|
} else if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
|
||||||
Command.C.cmd == MachO::LC_ID_DYLIB ||
|
Command.C.cmd == MachO::LC_ID_DYLIB ||
|
||||||
Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||
|
Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||
|
||||||
|
|||||||
Reference in New Issue
Block a user