diff options
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 4d2e59d..0ed614c 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -2243,43 +2243,6 @@ void Dumper::printRelocations() { } } -void objdump::printDynamicRelocations(const ObjectFile *Obj) { - // For the moment, this option is for ELF only - if (!Obj->isELF()) - return; - - const auto *Elf = dyn_cast<ELFObjectFileBase>(Obj); - if (!Elf || !any_of(Elf->sections(), [](const ELFSectionRef Sec) { - return Sec.getType() == ELF::SHT_DYNAMIC; - })) { - reportError(Obj->getFileName(), "not a dynamic object"); - return; - } - - std::vector<SectionRef> DynRelSec = Obj->dynamic_relocation_sections(); - if (DynRelSec.empty()) - return; - - outs() << "\nDYNAMIC RELOCATION RECORDS\n"; - const uint32_t OffsetPadding = (Obj->getBytesInAddress() > 4 ? 16 : 8); - const uint32_t TypePadding = 24; - outs() << left_justify("OFFSET", OffsetPadding) << ' ' - << left_justify("TYPE", TypePadding) << " VALUE\n"; - - StringRef Fmt = Obj->getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64; - for (const SectionRef &Section : DynRelSec) - for (const RelocationRef &Reloc : Section.relocations()) { - uint64_t Address = Reloc.getOffset(); - SmallString<32> RelocName; - SmallString<32> ValueStr; - Reloc.getTypeName(RelocName); - if (Error E = getRelocationValueString(Reloc, ValueStr)) - reportError(std::move(E), Obj->getFileName()); - outs() << format(Fmt.data(), Address) << ' ' - << left_justify(RelocName, TypePadding) << ' ' << ValueStr << '\n'; - } -} - // Returns true if we need to show LMA column when dumping section headers. We // show it only when the platform is ELF and either we have at least one section // whose VMA and LMA are different and/or when --show-lma flag is used. @@ -2866,7 +2829,7 @@ static void dumpObject(ObjectFile *O, const Archive *A = nullptr, if (Relocations && !Disassemble) D.printRelocations(); if (DynamicRelocations) - printDynamicRelocations(O); + D.printDynamicRelocations(); if (SectionContents) printSectionContents(O); if (Disassemble) |