Index: llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp +++ llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp @@ -29,9 +29,7 @@ MCSymbol *BeginLabel = Asm.createTempSymbol(Prefix + "start"); MCSymbol *EndLabel = Asm.createTempSymbol(Prefix + "end"); - Asm.OutStreamer->AddComment("Length of contribution"); - Asm.emitLabelDifference(EndLabel, BeginLabel, - 4); // TODO: Support DWARF64 format. + Asm.emitDwarfUnitLength(EndLabel, BeginLabel, "Length of contribution"); Asm.OutStreamer->emitLabel(BeginLabel); Asm.OutStreamer->AddComment("DWARF version number"); Asm.emitInt16(Asm.getDwarfVersion()); Index: llvm/test/DebugInfo/X86/debug-addr-dwarf64.ll =================================================================== --- /dev/null +++ llvm/test/DebugInfo/X86/debug-addr-dwarf64.ll @@ -0,0 +1,28 @@ +; This checks that .debug_addr can be generated in the DWARF64 format. + +; RUN: llc -mtriple=x86_64 -dwarf-version=5 -dwarf64 -filetype=obj %s -o %t +; RUN: llvm-dwarfdump -debug-info -debug-addr %t | FileCheck %s + +; CHECK: .debug_info contents: +; CHECK: DW_TAG_compile_unit +; CHECK: DW_AT_addr_base (0x0000000000000010) + +; CHECK: .debug_addr contents: +; CHECK-NEXT: Address table header: length = 0x000000000000000c, format = DWARF64, version = 0x0005, addr_size = 0x08, seg_size = 0x00 +; CHECK-NEXT: Addrs: [ +; CHECK-NEXT: 0x0000000000000004 +; CHECK-NEXT: ] + +@foo = common dso_local global i32 0, align 4, !dbg !5 + +!llvm.dbg.cu = !{!2} +!llvm.module.flags = !{!0} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = !DIFile(filename: "foo.c", directory: "/tmp") +!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Manual", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4, splitDebugInlining: false, nameTableKind: None) +!3 = !{} +!4 = !{!5} +!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression()) +!6 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true) +!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)