mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 18:24:00 +00:00
Add printing the LC_LINKER_OPTION load command with llvm-objdump’s -private-headers.
Also corrected the name of the load command to not end in an ’S’ as well as corrected the name of the MachO::linker_option_command struct and other places that had the word option as plural which did not match the Mac OS X headers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224485 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -3644,6 +3644,36 @@ static void PrintEncryptionInfoCommand64(MachO::encryption_info_command_64 ec,
|
||||
outs() << " pad " << ec.pad << "\n";
|
||||
}
|
||||
|
||||
static void PrintLinkerOptionCommand(MachO::linker_option_command lo,
|
||||
const char *Ptr) {
|
||||
outs() << " cmd LC_LINKER_OPTION\n";
|
||||
outs() << " cmdsize " << lo.cmdsize;
|
||||
if (lo.cmdsize < sizeof(struct MachO::linker_option_command))
|
||||
outs() << " Incorrect size\n";
|
||||
else
|
||||
outs() << "\n";
|
||||
outs() << " count " << lo.count << "\n";
|
||||
const char *string = Ptr + sizeof(struct MachO::linker_option_command);
|
||||
uint32_t left = lo.cmdsize - sizeof(struct MachO::linker_option_command);
|
||||
uint32_t i = 0;
|
||||
while (left > 0) {
|
||||
while (*string == '\0' && left > 0) {
|
||||
string++;
|
||||
left--;
|
||||
}
|
||||
if (left > 0) {
|
||||
i++;
|
||||
outs() << " string #" << i << " " << format("%.*s\n", left, string);
|
||||
uint32_t len = strnlen(string, left) + 1;
|
||||
string += len;
|
||||
left -= len;
|
||||
}
|
||||
}
|
||||
if (lo.count != i)
|
||||
outs() << " count " << lo.count << " does not match number of strings " << i
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
|
||||
if (dl.cmd == MachO::LC_ID_DYLIB)
|
||||
outs() << " cmd LC_ID_DYLIB\n";
|
||||
@ -3797,6 +3827,9 @@ static void PrintLoadCommands(const MachOObjectFile *Obj, uint32_t ncmds,
|
||||
} else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO_64) {
|
||||
MachO::encryption_info_command_64 Ei = Obj->getEncryptionInfoCommand64(Command);
|
||||
PrintEncryptionInfoCommand64(Ei, Buf.size());
|
||||
} else if (Command.C.cmd == MachO::LC_LINKER_OPTION) {
|
||||
MachO::linker_option_command Lo = Obj->getLinkerOptionLoadCommand(Command);
|
||||
PrintLinkerOptionCommand(Lo, Command.Ptr);
|
||||
} else if (Command.C.cmd == MachO::LC_LOAD_DYLIB ||
|
||||
Command.C.cmd == MachO::LC_ID_DYLIB ||
|
||||
Command.C.cmd == MachO::LC_LOAD_WEAK_DYLIB ||
|
||||
|
Reference in New Issue
Block a user