mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add -expand-relocs to llvm-readobj
This option expands shown relocations from single line to a dictionary format: Relocation { Offset: 0x4 Type: R_386_32 (1) Symbol: sym Info: 0x0 } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -341,18 +341,32 @@ void MachODumper::printRelocation(section_iterator SecI,
|
||||
const MachOObjectFileBase::RelocationEntry *RE = Obj->getRelocation(DR);
|
||||
bool IsScattered = Obj->isScattered(RE);
|
||||
|
||||
raw_ostream& OS = W.startLine();
|
||||
OS << W.hex(Offset)
|
||||
<< " " << Obj->isPCRel(RE)
|
||||
<< " " << Obj->getLength(RE);
|
||||
if (IsScattered)
|
||||
OS << " n/a";
|
||||
else
|
||||
OS << " " << RE->getExternal();
|
||||
OS << " " << RelocName
|
||||
<< " " << IsScattered
|
||||
<< " " << (SymbolName.size() > 0 ? SymbolName : "-")
|
||||
<< "\n";
|
||||
if (opts::ExpandRelocs) {
|
||||
DictScope Group(W, "Relocation");
|
||||
W.printHex("Offset", Offset);
|
||||
W.printNumber("PCRel", Obj->isPCRel(RE));
|
||||
W.printNumber("Length", Obj->getLength(RE));
|
||||
if (IsScattered)
|
||||
W.printString("Extern", StringRef("N/A"));
|
||||
else
|
||||
W.printNumber("Extern", RE->getExternal());
|
||||
W.printNumber("Type", RelocName, RE->getType());
|
||||
W.printString("Symbol", SymbolName.size() > 0 ? SymbolName : "-");
|
||||
W.printNumber("Scattered", IsScattered);
|
||||
} else {
|
||||
raw_ostream& OS = W.startLine();
|
||||
OS << W.hex(Offset)
|
||||
<< " " << Obj->isPCRel(RE)
|
||||
<< " " << Obj->getLength(RE);
|
||||
if (IsScattered)
|
||||
OS << " n/a";
|
||||
else
|
||||
OS << " " << RE->getExternal();
|
||||
OS << " " << RelocName
|
||||
<< " " << IsScattered
|
||||
<< " " << (SymbolName.size() > 0 ? SymbolName : "-")
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void MachODumper::printSymbols() {
|
||||
|
Reference in New Issue
Block a user