[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 18:56:15 PDT 2024


================
@@ -2687,6 +2687,15 @@ void Dumper::printRelocations() {
            << "VALUE\n";
 
     for (SectionRef Section : P.second) {
+      // CREL requires decoding and has its specific errors.
+      if (O.isELF() && ELFSectionRef(Section).getType() == ELF::SHT_CREL) {
+        const ELFObjectFileBase *ELF = cast<const ELFObjectFileBase>(&O);
+        StringRef Err = ELF->getCrelError(Section);
+        if (!Err.empty()) {
+          reportUniqueWarning(Err);
----------------
MaskRay wrote:

Adopted `getCrelDecodeProblem`.

> My expectation for a decode error would be that we report it, but continue as best we can. I would expect a non-zero error code though. Please ignore if this isn't llvm-objdump practice.

llvm-readobj tries to continue execution and report warnings. While a lot of code in llvm-objdump reports errors, there have been efforts to migrate to warnings: https://reviews.llvm.org/D154754

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


More information about the llvm-branch-commits mailing list