The source language ID and CPU version ID are required by debuggers.
AIX's system assembler determines the source language ID based on the source file's name suffix, and the behavior in this patch is consistent with it.
Details
- Reviewers
shchenz hubert.reinterpretcast DiggerLin jhenderson stephenpeckham - Group Reviewers
Restricted Project - Commits
- rG776195865d4f: [XCOFF] Write source language ID and CPU version ID into C_FILE symbol.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
1116 | 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 | |
1123 | 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. |
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
1121 | Please also handle the FORTRAN suffixs |
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
1107–1108 | You could use FileName instead of F.first. By the way, the system assembler generates a C_FILE symbol with auxiliary symbol table entries, allowing the compiler version and timestamp to be specified. (That might need a separate patch.) |
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
1120 | Shouldn't this be "endswith" instead of "ends_with_insensitive"? Otherwise, .C looks like TB_C. Maybe you should check for .c first, then default to TB_CPLUSPLUS. (If you want checks for other languages, such as Fortran, you could add them.). |
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
1121 | Thanks! |
llvm/lib/MC/XCOFFObjectWriter.cpp | ||
---|---|---|
1121 |
@Esme, iiuc, the integrated-as mode was made the default on AIX during the LLVM 17 development cycle and, without this, there is a regression in debugging Clang-compiled programs with AIX dbx?
If so, I believe this should be considered for the LLVM 17 release branch (i.e., backport if this does not land before the release split).
Please see llvm/test/CodeGen/PowerPC/aix-filename-c.ll. Does it meet your expectation?
Yes, dbx requires the correct source language ID to locate symbols.
Thank you for reminding!
Please see llvm/test/CodeGen/PowerPC/aix-filename-c.ll. Does it meet your expectation?
Yes, sorry. I missed seeing that test earlier.
You could use FileName instead of F.first.
By the way, the system assembler generates a C_FILE symbol with auxiliary symbol table entries, allowing the compiler version and timestamp to be specified. (That might need a separate patch.)