[llvm-branch-commits] [llvm-objdump] -r: support CREL (PR #97382)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jul 2 20:56:51 PDT 2024


================
@@ -1453,6 +1525,15 @@ template <class ELFT> bool ELFObjectFile<ELFT>::isRelocatableObject() const {
   return EF.getHeader().e_type == ELF::ET_REL;
 }
 
+template <class ELFT>
+StringRef ELFObjectFile<ELFT>::getCrelError(DataRefImpl Sec) const {
+  uintptr_t SHT = reinterpret_cast<uintptr_t>(cantFail(EF.sections()).begin());
+  auto I = (Sec.p - SHT) / EF.getHeader().e_shentsize;
+  if (I < CrelErrs.size())
+    return CrelErrs[I];
+  return "";
----------------
MaskRay wrote:

I have changed `mutable SmallVector<std::string, 0> CrelErrs;` so that it is only non-empty when there is a decoder problem. This is now needed.

https://github.com/llvm/llvm-project/pull/97382


More information about the llvm-branch-commits mailing list