[llvm] [llvm-readobj][COFF] Implement --coff-pseudoreloc in llvm-readobj to dump runtime pseudo-relocation records (PR #151816)

Tomohiro Kashiwada via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 10 20:07:02 PDT 2025


================
@@ -2000,6 +2001,217 @@ void COFFDumper::printCOFFBaseReloc() {
   }
 }
 
+void COFFDumper::printCOFFPseudoReloc() {
+  if (!Obj->getDOSHeader()) {
+    W.startLine()
+        << "pseudo-relocation is only meaningful for a PE image file\n";
----------------
kikairoya wrote:

I've made changes to exit silently with showing an empty list on these conditions:
- not an exe/dll image file
- the symbol table was stripped
- the relocation list has no entry
- the size of the relocation list is zero (begin == end)

and to warn with `reportWarning` on these conditions:
- the marker of the pseudo relocation is absent from the symbol table
- the header of relocation list is broken
- the marker of the relocation list points out of section space
- the size of the relocation list is negative
- the symbol table is broken
  * the symbol table is truncated
  * the name of the symbol or the section can't be fetched
    (I can't make the tests for these 2 conditions, because yaml2obj can't generate such corrupted binary. )
  * the section which the symbol belongs to is not found



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


More information about the llvm-commits mailing list