[PATCH] D126623: [XCOFF] write the real source file name in C_FILE symbol.

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 19 19:55:49 PDT 2022


shchenz added a comment.

oops, my last comment is for previous change, don't aware the patch is already updated when I posted that comment.



================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:498
+  FileNames = Asm.getFileNames();
+  if (FileNames.empty())
+    FileNames.emplace_back(".file", 0);
----------------
Seems all the `.file` symbols are all changed to <stdin>? Can we add a new case for this branch?


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:860
 void XCOFFObjectWriter::writeSymbolTable(const MCAsmLayout &Layout) {
-  // Write symbol 0 as C_FILE.
+  // Write .file symbols.
   // The n_name of a C_FILE symbol is the source file's name when no auxiliary
----------------
Nits: Write C_FILE symbols?


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:963
 void XCOFFObjectWriter::assignAddressesAndIndices(const MCAsmLayout &Layout) {
-  // The first symbol table entry (at index 0) is for the file name.
-  uint32_t SymbolTableIndex = 1;
+  // The symbol table starts with all the .file symbols.
+  uint32_t SymbolTableIndex = FileNames.size();
----------------
C_FILE?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126623



More information about the llvm-commits mailing list