[PATCH] D155684: [XCOFF] Write source language ID and CPU version ID into C_FILE symbol.

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 06:17:58 PDT 2023


shchenz added a subscriber: stephenpeckham.
shchenz added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:1111
+    // AIX's system assembler determines the source language ID based on the
+    // source file's name suffix, and our behavior here is consistent with it.
+    uint8_t LangID;
----------------
This is not unreliable, for example you can compile files with many kinds of suffix or even without suffix as a c++ file if you specify `-x c++`. However seems we don't have accurate info in IR to identify the language ID if no -g. So I think it is OK here to have same handling with system assembler.

System assembler treats following suffix as C++ file:
```
.C, .cc, .ii, .cpp, .cxx, .c++
.ccm, .iim, .cppm, .cxxm, .c++m
.CC, .CPP, .CXX, .C++
```
Copied from @stephenpeckham 


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:1118
+    else
+      LangID = 0xC;
+    uint8_t CpuID;
----------------
Why set the default to `0XC`?(assembly file? we won't use integrated-assembler to compile assembly files). Maybe we can default to C++ like traceback table does, and by doing this, we also have consistent language ID in the symbol table and the trace back table.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155684



More information about the llvm-commits mailing list