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

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 5 14:34:10 PDT 2024


================
@@ -1117,9 +1155,11 @@ void ELFObjectFile<ELFT>::getRelocationTypeName(
 template <class ELFT>
 Expected<int64_t>
 ELFObjectFile<ELFT>::getRelocationAddend(DataRefImpl Rel) const {
-  if (getRelSection(Rel)->sh_type != ELF::SHT_RELA)
-    return createError("Section is not SHT_RELA");
-  return (int64_t)getRela(Rel)->r_addend;
+  if (getRelSection(Rel)->sh_type == ELF::SHT_RELA)
+    return (int64_t)getRela(Rel)->r_addend;
+  if (getRelSection(Rel)->sh_type == ELF::SHT_CREL)
+    return (int64_t)getCrel(Rel).r_addend;
+  return createError("Section is not SHT_RELA");
----------------
MaskRay wrote:

Error message adjusted. I think this line is dynamically unreachable.

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


More information about the llvm-branch-commits mailing list