[PATCH] D130670: [llvm-readelf] Render messages similar to that of `GNU binutils readelf` when no sections and/or no headers.

Prabhu Karthikeyan Rajasekaran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 10:08:16 PDT 2022


Prabhuk added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/many-sections.s:45
-# GNU2-NEXT:   [Nr] Name Type Address Off Size ES Flg Lk Inf Al
-# GNU2-NEXT:  warning: '[[FILE]]': e_shstrndx == SHN_XINDEX, but the section header table is empty
-# GNU2-NEXT:  Key to Flags:
----------------
jhenderson wrote:
> Isn't this warning still expected to be emitted?
Rendering the warning in this case and bringing back the warning message test to the test file.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:4069-4072
+  if (Sections.size() == 0) {
+    OS << "\nThere are no sections in this file.\n";
+    return;
+  }
----------------
jhenderson wrote:
> Seems like this case isn't tested?
Thank you. Added tests to cover this path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130670



More information about the llvm-commits mailing list