[llvm] [llvm][DebugInfo] Emit DW_LNAME_Assembly for DWARFv6 assembly CUs (PR #183897)

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 08:52:47 PST 2026


================
@@ -1092,9 +1097,15 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
     MCOS->emitBytes(StringRef("llvm-mc (based on LLVM " PACKAGE_VERSION ")"));
   MCOS->emitInt8(0); // NULL byte to terminate the string.
 
-  // AT_language, a 4 byte value.  We use DW_LANG_Mips_Assembler as the dwarf2
-  // draft has no standard code for assembler.
-  MCOS->emitInt16(dwarf::DW_LANG_Mips_Assembler);
+  if (context.getDwarfVersion() >= 6) {
+    // AT_language_name, a 4 byte value.
+    MCOS->emitInt16(dwarf::DW_LNAME_Assembly);
+  } else {
+    // AT_language, a 4 byte value.  We use DW_LANG_Mips_Assembler as the dwarf2
+    // draft has no standard code for assembler.
+    // FIXME: dwarf4 has DW_LANG_Assembly which we could use instead.
+    MCOS->emitInt16(dwarf::DW_LANG_Mips_Assembler);
----------------
adrian-prantl wrote:

I think the right thing to do would be to emit 
```
DW_LANG_Assembly	0x0031	0
```
here.

https://dwarfstd.org/languages.html

https://github.com/llvm/llvm-project/pull/183897


More information about the llvm-commits mailing list