[PATCH] D111700: [XCOFF] [llvm-readobj] improve the relocation output.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 18:42:25 PDT 2021


Higuoxing added inline comments.


================
Comment at: llvm/tools/llvm-readobj/XCOFFDumper.cpp:149-150
+    OS << W.hex(Reloc.VirtualAddress) << " " << RelocName << " " << SymbolName
+       << "(" << Reloc.SymbolIndex << ")";
+    OS << "\n";
+  }
----------------



================
Comment at: llvm/tools/llvm-readobj/XCOFFDumper.cpp:174-189
+    bool PrintedGroup = false;
     for (const RelTy Reloc : Relocations) {
-      Expected<StringRef> ErrOrSymbolName =
-          Obj.getSymbolNameByIndex(Reloc.SymbolIndex);
-      if (Error E = ErrOrSymbolName.takeError()) {
-        reportUniqueWarning(std::move(E));
-        continue;
+      if (!PrintedGroup) {
+        W.startLine() << "Section (index: " << Index << ") " << Sec.getName()
+                      << " {\n";
+        W.indent();
+        PrintedGroup = true;
----------------
I think we can simplify it by using index to iterate the relocation entries.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111700/new/

https://reviews.llvm.org/D111700



More information about the llvm-commits mailing list