[PATCH] D107421: [yaml2obj][XCOFF] Customize the string table.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 12 02:36:42 PDT 2021


Higuoxing added inline comments.


================
Comment at: llvm/lib/ObjectYAML/XCOFFEmitter.cpp:396-397
   // Write the string table.
-  if (Strings.getSize() > 4)
-    Strings.write(W.OS);
+  if (StrTbl.getSize() > 4 && !Obj.StrTbl.Suppressed)
+    StrTbl.write(W.OS);
   return true;
----------------
Esme wrote:
> Higuoxing wrote:
> > I believe You're are able to pad the string table to a specified length without modifying the interface of `StringTableBuilder`. Please let me know if it doesn't work :)
> > 
> If so, we have to rewrite the length value in the string table, otherwise these padding zeros  will not be treated as string table contents.
I think you can do that by creating a temporary buffer.

1. Serialize string table builder's content together with padding zeros to a temporary buffer.
2. Modify the first 4-byte of the temporary buffer.
3. Serialize the temporary buffer to the actual output stream.

@jhenderson any ideas?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107421



More information about the llvm-commits mailing list