summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/ELFDumper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-readobj/ELFDumper.cpp')
-rw-r--r--llvm/tools/llvm-readobj/ELFDumper.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index b6fed4f3c34..2492fa2acc2 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -2641,6 +2641,14 @@ template <class ELFT> void GNUStyle<ELFT>::printRelocations(const ELFO *Obj) {
HasRelocSections = true;
StringRef Name = unwrapOrError(Obj->getSectionName(&Sec));
unsigned Entries = Sec.getEntityCount();
+ std::vector<Elf_Rela> AndroidRelas;
+ if (Sec.sh_type == ELF::SHT_ANDROID_REL ||
+ Sec.sh_type == ELF::SHT_ANDROID_RELA) {
+ // Android's packed relocation section needs to be unpacked first
+ // to get the actual number of entries.
+ AndroidRelas = unwrapOrError(Obj->android_relas(&Sec));
+ Entries = AndroidRelas.size();
+ }
uintX_t Offset = Sec.sh_offset;
OS << "\nRelocation section '" << Name << "' at offset 0x"
<< to_hexString(Offset, false) << " contains " << Entries
@@ -2665,7 +2673,7 @@ template <class ELFT> void GNUStyle<ELFT>::printRelocations(const ELFO *Obj) {
break;
case ELF::SHT_ANDROID_REL:
case ELF::SHT_ANDROID_RELA:
- for (const auto &R : unwrapOrError(Obj->android_relas(&Sec)))
+ for (const auto &R : AndroidRelas)
printRelocation(Obj, SymTab, R, Sec.sh_type == ELF::SHT_ANDROID_RELA);
break;
}
OpenPOWER on IntegriCloud