[llvm] [llvm-objdump] Display RELR dynamic relocations (PR #224069)
Tianyi Chen via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 19 01:56:25 PDT 2026
================
@@ -364,7 +364,23 @@ template <typename ELFT> void ELFDumper<ELFT>::printDynamicRelocations() {
<< left_justify("TYPE", TypePadding) << " VALUE\n";
StringRef Fmt = Obj.getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64;
- for (const SectionRef &Section : DynRelSec)
+ for (const SectionRef &Section : DynRelSec) {
+ if (ELFSectionRef(Section).getType() == ELF::SHT_RELR) {
+ const auto &Elf = getELFFile();
+ auto Relrs =
+ unwrapOrError(Elf.relrs(*Obj.getSection(Section.getRawDataRefImpl())),
+ Obj.getFileName());
+ StringRef RelocName =
+ Elf.getRelocationTypeName(Elf.getRelativeRelocationType());
+ for (const auto &Rel : Elf.decode_relrs(Relrs)) {
+ uint64_t Address = Rel.r_offset;
+ // RELR has neither a symbol reference nor an explicit addend.
----------------
chenty2333 wrote:
Thanks, agreed. RELR encodes the relocation locations, not explicit addends; the implicit addend lives at the relocated location. I have kept '-' rather than inferring an addend from the RELR entries.
https://github.com/llvm/llvm-project/pull/224069
More information about the llvm-commits
mailing list