mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
[llvm-objdump] support -rebase option for mach-o to dump rebasing info
Similar to my previous -exports-trie option, the -rebase option dumps info from the LC_DYLD_INFO load command. The rebasing info is a list of the the locations that dyld needs to adjust if a mach-o image is not loaded at its preferred address. Since ASLR is now the default, images almost never load at their preferred address, and thus need to be rebased by dyld. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217709 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -81,6 +81,9 @@ SymbolTable("t", cl::desc("Display the symbol table"));
|
||||
static cl::opt<bool>
|
||||
ExportsTrie("exports-trie", cl::desc("Display mach-o exported symbols"));
|
||||
|
||||
static cl::opt<bool>
|
||||
Rebase("rebase", cl::desc("Display mach-o rebasing info"));
|
||||
|
||||
static cl::opt<bool>
|
||||
MachOOpt("macho", cl::desc("Use MachO specific object file parser"));
|
||||
static cl::alias
|
||||
@ -720,6 +723,18 @@ static void printExportsTrie(const ObjectFile *o) {
|
||||
}
|
||||
}
|
||||
|
||||
static void printRebaseTable(const ObjectFile *o) {
|
||||
outs() << "Rebase table:\n";
|
||||
if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
|
||||
printMachORebaseTable(MachO);
|
||||
else {
|
||||
errs() << "This operation is only currently supported "
|
||||
"for Mach-O executable files.\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void printPrivateFileHeader(const ObjectFile *o) {
|
||||
if (o->isELF()) {
|
||||
printELFFileHeader(o);
|
||||
@ -751,6 +766,8 @@ static void DumpObject(const ObjectFile *o) {
|
||||
printPrivateFileHeader(o);
|
||||
if (ExportsTrie)
|
||||
printExportsTrie(o);
|
||||
if (Rebase)
|
||||
printRebaseTable(o);
|
||||
}
|
||||
|
||||
/// @brief Dump each object file in \a a;
|
||||
@ -833,7 +850,8 @@ int main(int argc, char **argv) {
|
||||
&& !SymbolTable
|
||||
&& !UnwindInfo
|
||||
&& !PrivateHeaders
|
||||
&& !ExportsTrie) {
|
||||
&& !ExportsTrie
|
||||
&& !Rebase) {
|
||||
cl::PrintHelpMessage();
|
||||
return 2;
|
||||
}
|
||||
|
Reference in New Issue
Block a user