summaryrefslogtreecommitdiffstats
path: root/tools/llvm-readobj
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-04-12 00:17:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-04-12 00:17:33 +0000
commite292347503cd7598429c08f9984ab3e0a44ab8a3 (patch)
tree95a231a9f2d14de9a5043f87149698c3786a631c /tools/llvm-readobj
parent33c55bdfed027313b05217d7049aa0e810da5caa (diff)
downloadexternal_llvm-e292347503cd7598429c08f9984ab3e0a44ab8a3.zip
external_llvm-e292347503cd7598429c08f9984ab3e0a44ab8a3.tar.gz
external_llvm-e292347503cd7598429c08f9984ab3e0a44ab8a3.tar.bz2
Add 179294 back, but don't use bit fields so that it works on big endian hosts.
Original message: Print more information about relocations. With this patch llvm-readobj now prints if a relocation is pcrel, its length, if it is extern and if it is scattered. It also refactors the code a bit to use bit fields instead of shifts and masks all over the place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179345 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-readobj')
-rw-r--r--tools/llvm-readobj/MachODumper.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/llvm-readobj/MachODumper.cpp b/tools/llvm-readobj/MachODumper.cpp
index 2073ddf..a13593b 100644
--- a/tools/llvm-readobj/MachODumper.cpp
+++ b/tools/llvm-readobj/MachODumper.cpp
@@ -330,20 +330,28 @@ void MachODumper::printRelocation(section_iterator SecI,
relocation_iterator RelI) {
uint64_t Offset;
SmallString<32> RelocName;
- int64_t Info;
StringRef SymbolName;
SymbolRef Symbol;
if (error(RelI->getOffset(Offset))) return;
if (error(RelI->getTypeName(RelocName))) return;
- if (error(RelI->getAdditionalInfo(Info))) return;
if (error(RelI->getSymbol(Symbol))) return;
if (error(Symbol.getName(SymbolName))) return;
+ DataRefImpl DR = RelI->getRawDataRefImpl();
+ const MachOObjectFileBase::RelocationEntry *RE = Obj->getRelocation(DR);
+ bool IsScattered = Obj->isScattered(RE);
+
raw_ostream& OS = W.startLine();
OS << W.hex(Offset)
- << " " << RelocName
+ << " " << Obj->isPCRel(RE)
+ << " " << Obj->getLength(RE);
+ if (IsScattered)
+ OS << " n/a";
+ else
+ OS << " " << RE->getExternal();
+ OS << " " << RelocName
+ << " " << IsScattered
<< " " << (SymbolName.size() > 0 ? SymbolName : "-")
- << " " << W.hex(Info)
<< "\n";
}