[llvm] 5e90b7b - [DebugInfo] Make DW_AT_LLVM_stmt_seq work with split DWARF (#213128)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 19:07:10 PDT 2026
Author: Aiden Grossman
Date: 2026-07-30T19:07:05-07:00
New Revision: 5e90b7bad3cc0960a26f46969063c5acf03ac137
URL: https://github.com/llvm/llvm-project/commit/5e90b7bad3cc0960a26f46969063c5acf03ac137
DIFF: https://github.com/llvm/llvm-project/commit/5e90b7bad3cc0960a26f46969063c5acf03ac137.diff
LOG: [DebugInfo] Make DW_AT_LLVM_stmt_seq work with split DWARF (#213128)
Before this change, we would end up with a relocation in the dwo, which
would then result in an error.
Added:
llvm/test/DebugInfo/X86/DW_AT_LLVM_stmt_seq_split_dwarf.ll
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index d336e60b40991..7072fc9c8d2fb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -524,9 +524,15 @@ DIE &DwarfCompileUnit::updateSubprogramScopeDIE(const DISubprogram *SP,
addFlag(*SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr);
if (emitFuncLineTableOffsets() && LineTableSym) {
- addSectionLabel(
- *SPDie, dwarf::DW_AT_LLVM_stmt_sequence, LineTableSym,
- Asm->getObjFileLowering().getDwarfLineSection()->getBeginSymbol());
+ MCSymbol *Symbol =
+ Asm->getObjFileLowering().getDwarfLineSection()->getBeginSymbol();
+ if (isDwoUnit()) {
+ addSectionDelta(*SPDie, dwarf::DW_AT_LLVM_stmt_sequence, LineTableSym,
+ Symbol);
+ } else {
+ addSectionLabel(*SPDie, dwarf::DW_AT_LLVM_stmt_sequence, LineTableSym,
+ Symbol);
+ }
}
// Only include DW_AT_frame_base in full debug info
diff --git a/llvm/test/DebugInfo/X86/DW_AT_LLVM_stmt_seq_split_dwarf.ll b/llvm/test/DebugInfo/X86/DW_AT_LLVM_stmt_seq_split_dwarf.ll
new file mode 100644
index 0000000000000..3e1c6c2b0d907
--- /dev/null
+++ b/llvm/test/DebugInfo/X86/DW_AT_LLVM_stmt_seq_split_dwarf.ll
@@ -0,0 +1,22 @@
+; RUN: llc -split-dwarf-file=foo.dwo -split-dwarf-output=%t.dwo -o %t.o -filetype=obj %s -emit-func-debug-line-table-offsets
+; RUN: llvm-dwarfdump -v -all %t.dwo | FileCheck %s
+
+; CHECK: DW_AT_LLVM_stmt_sequence
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @splitmountain07030226() !dbg !4 {
+entry:
+ ret void
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 24.0.0git (https://github.com/llvm/llvm-project 005b3858f602ec5a193740cb166244d5234ce98f)", isOptimized: false, runtimeVersion: 0, splitDebugFilename: "/tmp/test.dwo", emissionKind: FullDebug, globals: !2, splitDebugInlining: false, nameTableKind: GNU)
+!1 = !DIFile(filename: "newspicer073126", directory: "yosemite080326")
+!2 = !{}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = distinct !DISubprogram(name: "splitmountain07030226", linkageName: "splitmountain07030226", scope: !5, file: !5, line: 2, type: !6, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
+!5 = !DIFile(filename: "newspicer073126", directory: "yosemite080326", checksumkind: CSK_MD5, checksum: "20fb564d6e0e7db96628bc4acf1721b4")
+!6 = !DISubroutineType(types: !2)
More information about the llvm-commits
mailing list