[PATCH] D105522: [llvm-readobj][XCOFF] Fix the error dumping for the first item of StringTable.

Esme Yi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 23:44:51 PDT 2021


Esme added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/XCOFF/string-table.yaml:30
+
+## There is an empty string table with just the length field.
+## TODO: Print the string table size to check the length field.
----------------
jhenderson wrote:
> Why does 32-bit XCOFF generate an empty string table if it isn't used? Is that a bug in the emitter, or a spec detail?
Hmm...I think it's neither a spec detail, nor a bug? That's just how we implement in yaml2obj. We write the string table if the symbol table isn't empty. 
```
if (!Obj.Symbols.empty()) {
    if (!writeSymbols())
      return false;
    // Write the string table.
    Strings.write(W.OS);
}
```
Due to the fact that only long symbol name can be written into the string table for 32-bit XCOFF, I write the test of non-empty symbol table without long symbol names.
As for 64-bit XCOFF, the symbol name is a required field and all symbol names will be written into the string table, so I can't write such test under 64-bit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105522



More information about the llvm-commits mailing list