[PATCH] D95518: [Debug-Info][XCOFF] support dwarf for XCOFF in assembly path

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 10 01:46:01 PST 2021


shchenz added a comment.

In D95518#2553303 <https://reviews.llvm.org/D95518#2553303>, @MaskRay wrote:

>> in assembly path
>
> I was a bit confused by this term. You may just use MCAsmStreamer.
>
> Hi, I have followed some part of the patch, mainly related to `MCDwarfLineEntry::Make`. Can you please explain a bit why .file/.loc cannot be used for assembler output?
> If you have desire to implement .file/.loc for integrated assemblers, you will not need alternative paths to .file/.loc .
> If you have other tools and they cannot consume .file/.loc, please make it clear.

Yes, the reason we need to populate the .dwline section with raw data on AIX is AIX assembler does not support `.file`/`.loc` directives. But it should be easy to switch back to the `.file`/`.loc` way by modifying the flag value `UsesDwarfFileAndLocDirectives`.



================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:394
+
+  if (!Dwarf64 && TT.isArch64Bit() && TT.isOSBinFormatXCOFF())
+    report_fatal_error("XCOFF requires DWARF64 for 64-bit mode!");
----------------
MaskRay wrote:
> The report_fatal_error only triggers if `DwarfVersion < 3`. I think the driver and llvm-mc should surface the error and essentially make this line unreachable: then due to whether we have an error subsequently, this report_fatal_error may not be needed.
Could you help to point out the places that checks `DWARF64` and dwarf version 3? As I tested, there is no error if I compile with `clang -m64 -gdwarf-2 t.c` on AIX without the new added `report_fatal_error`.


================
Comment at: llvm/lib/MC/MCAsmStreamer.cpp:1104
+  // Target doesn't support .loc/.file directives, return early.
+  if (!MAI->usesDwarfFileAndLocDirectives())
+    return;
----------------
MaskRay wrote:
> Drop this line - which is untested.
> 
> Does XCOFF support DWARF v5? MCObjectFileInfo does not have them. The binary format seems to hard code some section type values.
> 
Yes, currently the debug sections are hardcoded and it is not able to support DWARF v5. But we are going to (partly) support it in the near future. So I prefer to keep it here.


================
Comment at: llvm/test/DebugInfo/XCOFF/empty.ll:171
+; ASM32-NEXT:  L..info_string0:
+; ASM32-NEXT:   .byte   'c,'l,'a,'n,'g,' ,'v,'e,'r,'s,'i,'o,'n,' ,'1,'2,'.,'0,'.,'0,0000 # string offset=0
+; ASM32-NEXT:  L..info_string1:
----------------
MaskRay wrote:
> Is .ascii or .asciz available?
These two directives are not supported by AIX assembler. https://www.ibm.com/support/knowledgecenter/ssw_aix_72/assembler/idalangref_pseudo_ops_oview.html

BTW, do we have any control option to use `.ascii`/`.asciz`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95518



More information about the llvm-commits mailing list