diff options
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 13 | ||||
-rw-r--r-- | llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll | 5 |
2 files changed, 14 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 624e1a513ec..b91f613f1ce 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1193,10 +1193,15 @@ void DwarfDebug::finalizeModuleInfo() { auto *CUNode = cast<DICompileUnit>(P.first); // If compile Unit has macros, emit "DW_AT_macro_info" attribute. - if (CUNode->getMacros() && !useSplitDwarf()) - U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_macro_info, - U.getMacroLabelBegin(), - TLOF.getDwarfMacinfoSection()->getBeginSymbol()); + if (CUNode->getMacros()) + if (useSplitDwarf()) + TheCU.addLabelDelta(TheCU.getUnitDie(), dwarf::DW_AT_macro_info, + U.getMacroLabelBegin(), + TLOF.getDwarfMacinfoDWOSection()->getBeginSymbol()); + else + U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_macro_info, + U.getMacroLabelBegin(), + TLOF.getDwarfMacinfoSection()->getBeginSymbol()); } // Emit all frontend-produced Skeleton CUs, i.e., Clang modules. diff --git a/llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll b/llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll index 07a53225ace..43255f2c4ce 100644 --- a/llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll +++ b/llvm/test/DebugInfo/X86/debug-macinfo-split-dwarf.ll @@ -1,5 +1,10 @@ ; RUN: %llc_dwarf -O0 -split-dwarf-file=foo.dwo -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck %s +; CHECK-LABEL:.debug_info.dwo contents: +; CHECK: DW_AT_GNU_dwo_name [DW_FORM_GNU_str_index] (indexed (00000006) string = "foo.dwo") +; CHECK-NEXT: DW_AT_GNU_dwo_id [DW_FORM_data8] (0xe0f109905cbe1fe4) +; CHECK-NEXT: DW_AT_macro_info [DW_FORM_data4] (0x00000000) + ;CHECK-LABEL:.debug_macinfo.dwo contents: ;CHECK-NEXT: DW_MACINFO_start_file - lineno: 0 filenum: 1 ;CHECK-NEXT: DW_MACINFO_start_file - lineno: 1 filenum: 2 |