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

James Henderson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 5 02:04:06 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");
----------------
jh7370 wrote:

I'm not sure this error quite makes sense anymore. Probably needs to say something about addends.

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


More information about the llvm-branch-commits mailing list