[llvm] r337981 - [DWARF v5] Don't emit multiple DW_AT_rnglists_base attributes. Some refactoring of
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 31 10:56:18 PDT 2018
I’ll take a stab at fixing the test (along with removing the DWARF 4 behavior) in a different review.
-- wolfgang
From: David Blaikie [mailto:dblaikie at gmail.com]
Sent: Monday, July 30, 2018 6:41 PM
To: Pieb, Wolfgang
Cc: aprantl at apple.com; jdevlieghere at apple.com; arphaman at gmail.com; llvm-commits at lists.llvm.org
Subject: Re: [llvm] r337981 - [DWARF v5] Don't emit multiple DW_AT_rnglists_base attributes. Some refactoring of
Sounds like the test should be fixed instead - doesn't look like there's any reason DWARFv4 should get different behavior here, only a bug in the test?
On Mon, Jul 30, 2018 at 3:23 PM <wolfgang.pieb at sony.com<mailto:wolfgang.pieb at sony.com>> wrote:
In emitDebugRanges() in DwarfDebug.cpp my original change returns early when there are no ranges to be emitted. This means no __debug_ranges section is created. The test looks for __debug_ranges anyway, even though there is only a trivial function. I just re-enabled this behavior for DWARF4 and earlier. Reverse patch:
Index: DwarfDebug.cpp
===================================================================
--- DwarfDebug.cpp (revision 338127)
+++ DwarfDebug.cpp (working copy)
@@ -2136,7 +2136,7 @@
return;
}
- if (getDwarfVersion() >= 5 && NoRangesPresent())
+ if (NoRangesPresent())
return;
// Start the dwarf ranges section.
-- wolfgang
From: David Blaikie [mailto:dblaikie at gmail.com<mailto:dblaikie at gmail.com>]
Sent: Monday, July 30, 2018 1:44 PM
To: Pieb, Wolfgang; Adrian Prantl; Jonas Devlieghere
Cc: arphaman at gmail.com<mailto:arphaman at gmail.com>; llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
Subject: Re: [llvm] r337981 - [DWARF v5] Don't emit multiple DW_AT_rnglists_base attributes. Some refactoring of
Adrian, Jonas - could you two take a look at this test failure/issue & see if it could be fixed.
Wolfgang - what was the change you made/undid from your original patch?
On Thu, Jul 26, 2018 at 3:53 PM via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
Thanks, Alex.
I resubmitted the patch as r338081 with a fix. It’s a bit unfortunate, b/c the compiler was actually being more efficient about not emitting a __debug_ranges section when none is needed. The test, however, checks for it anyway. I didn’t want to mess with the test because its purpose is a bit different, so I restored the old behavior for dwarf version 4 and earlier.
Let me know if you see any more problems.
-- wolfgang
From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org<mailto:llvm-commits-bounces at lists.llvm.org>] On Behalf Of Alex L via llvm-commits
Sent: Wednesday, July 25, 2018 8:23 PM
To: Pieb, Wolfgang
Cc: Alex Lorenz via llvm-commits
Subject: Re: [llvm] r337981 - [DWARF v5] Don't emit multiple DW_AT_rnglists_base attributes. Some refactoring of
Hi,
Unfortunately I had to revert this commit (revert in r337997) as it caused a regression in the debuginfo-tests:
FAIL: debuginfo-tests :: apple-accel.cpp (40748 of 46595) ******************** TEST 'debuginfo-tests :: apple-accel.cpp' FAILED ******************** Script: -- : 'RUN: at line 6'; /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/bin/clang /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/test/debuginfo-tests/apple-accel.cpp --target=x86_64-apple-darwin17.6.0 -gdwarf-2 -O0 -c -g -o /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/tools/clang/test/debuginfo-tests/Output/apple-accel.cpp.tmp-ex : 'RUN: at line 7'; llvm-objdump -section-headers /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/tools/clang/test/debuginfo-tests/Output/apple-accel.cpp.tmp-ex | /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/bin/FileCheck /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/test/debuginfo-tests/apple-accel.cpp : 'RUN: at line 8'; /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/bin/clang /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/test/debuginfo-tests/apple-accel.cpp --target=x86_64-apple-darwin17.6.0 -gdwarf-4 -O0 -c -g -o /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/tools/clang/test/debuginfo-tests/Output/apple-accel.cpp.tmp-ex : 'RUN: at line 9'; llvm-objdump -section-headers /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/tools/clang/test/debuginfo-tests/Output/apple-accel.cpp.tmp-ex | /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/clang-build/bin/FileCheck /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/test/debuginfo-tests/apple-accel.cpp -- Exit Code: 1 Command Output (stderr): -- /Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/test/debuginfo-tests/apple-accel.cpp:16:16: error: CHECK-NEXT: expected string not found in input // CHECK-NEXT: __debug_ranges ^ <stdin>:9:17: note: scanning from here 3 __debug_info 00000087 0000000000000182 DATA ^ <stdin>:10:4: note: possible intended match here 4 __debug_macinfo 00000001 0000000000000209 DATA ^ -- ********************
Here's the failure in our CI: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/47691/consoleFull
Let me know if you need assistance investigating/verifying a fix.
Thanks,
Alex
On 25 July 2018 at 16:03, Wolfgang Pieb via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
Author: wolfgangp
Date: Wed Jul 25 16:03:22 2018
New Revision: 337981
URL: http://llvm.org/viewvc/llvm-project?rev=337981&view=rev
Log:
[DWARF v5] Don't emit multiple DW_AT_rnglists_base attributes. Some refactoring of
range lists emissions and added test cases.
Reviewer: dblaikie
Differential Revision: https://reviews.llvm.org/D49522
Added:
llvm/trunk/test/DebugInfo/X86/rnglists_base_attr.ll
llvm/trunk/test/DebugInfo/X86/rnglists_curanges.ll
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/trunk/test/DebugInfo/X86/cu-ranges.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=337981&r1=337980&r2=337981&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Jul 25 16:03:22 2018
@@ -420,8 +420,6 @@ void DwarfCompileUnit::addScopeRangeList
} else {
addSectionLabel(ScopeDIE, dwarf::DW_AT_ranges, List.getSym(),
RangeSectionSym);
- if (DD->getDwarfVersion() >= 5)
- addRnglistsBase();
}
// Add the range list to the set of ranges to be emitted.
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=337981&r1=337980&r2=337981&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jul 25 16:03:22 2018
@@ -820,6 +820,10 @@ void DwarfDebug::finalizeModuleInfo() {
U.attachRangesOrLowHighPC(U.getUnitDie(), TheCU.takeRanges());
}
+ if (getDwarfVersion() >= 5 && !useSplitDwarf() &&
+ !U.getRangeLists().empty())
+ U.addRnglistsBase();
+
auto *CUNode = cast<DICompileUnit>(P.first);
// If compile Unit has macros, emit "DW_AT_macro_info" attribute.
if (CUNode->getMacros())
@@ -2086,23 +2090,10 @@ static void emitRangeList(AsmPrinter *As
}
}
-void DwarfDebug::emitDebugRnglists() {
-
- // Don't emit a rangelist table if there are no ranges.
- if (llvm::all_of(CUMap,
- [](const decltype(CUMap)::const_iterator::value_type &Pair) {
- DwarfCompileUnit *TheCU = Pair.second;
- if (auto *Skel = TheCU->getSkeleton())
- TheCU = Skel;
- return TheCU->getRangeLists().empty();
- }))
- return;
-
- assert(getDwarfVersion() >= 5 && "Dwarf version must be 5 or greater");
- // FIXME: As long as we don't support DW_RLE_base_addrx, we cannot generate
- // any tables in the .debug_rnglists.dwo section.
- Asm->OutStreamer->SwitchSection(
- Asm->getObjFileLowering().getDwarfRnglistsSection());
+// Emit the header of a DWARF 5 range list table. Returns the symbol that
+// designates the end of the table for the caller to emit when the table is
+// complete.
+static MCSymbol *emitRnglistsTableHeader(AsmPrinter *Asm, DwarfFile &Holder) {
// The length is described by a starting label right after the length field
// and an end label.
MCSymbol *TableStart = Asm->createTempSymbol("debug_rnglist_table_start");
@@ -2111,56 +2102,52 @@ void DwarfDebug::emitDebugRnglists() {
Asm->EmitLabelDifference(TableEnd, TableStart, 4);
Asm->OutStreamer->EmitLabel(TableStart);
// Version number (DWARF v5 and later).
- Asm->emitInt16(getDwarfVersion());
+ Asm->emitInt16(Asm->OutStreamer->getContext().getDwarfVersion());
// Address size.
Asm->emitInt8(Asm->MAI->getCodePointerSize());
// Segment selector size.
Asm->emitInt8(0);
- MCSymbol *RnglistTableBaseSym =
- (useSplitDwarf() ? SkeletonHolder : InfoHolder).getRnglistsTableBaseSym();
+ MCSymbol *RnglistTableBaseSym = Holder.getRnglistsTableBaseSym();
// FIXME: Generate the offsets table and use DW_FORM_rnglistx with the
// DW_AT_ranges attribute. Until then set the number of offsets to 0.
Asm->emitInt32(0);
Asm->OutStreamer->EmitLabel(RnglistTableBaseSym);
-
- // Emit the individual range lists.
- for (const auto &I : CUMap) {
- DwarfCompileUnit *TheCU = I.second;
- if (auto *Skel = TheCU->getSkeleton())
- TheCU = Skel;
- for (const RangeSpanList &List : TheCU->getRangeLists())
- emitRangeList(Asm, TheCU, List);
- }
-
- Asm->OutStreamer->EmitLabel(TableEnd);
+ return TableEnd;
}
-/// Emit address ranges into the .debug_ranges section or DWARF v5 rangelists
-/// into the .debug_rnglists section.
+/// Emit address ranges into the .debug_ranges section or into the DWARF v5
+/// .debug_rnglists section.
void DwarfDebug::emitDebugRanges() {
if (CUMap.empty())
return;
+ auto NoRangesPresent = [this]() {
+ return llvm::all_of(
+ CUMap, [](const decltype(CUMap)::const_iterator::value_type &Pair) {
+ return Pair.second->getRangeLists().empty();
+ });
+ };
+
if (!useRangesSection()) {
- assert(llvm::all_of(
- CUMap,
- [](const decltype(CUMap)::const_iterator::value_type &Pair) {
- return Pair.second->getRangeLists().empty();
- }) &&
- "No debug ranges expected.");
+ assert(NoRangesPresent() && "No debug ranges expected.");
return;
}
- if (getDwarfVersion() >= 5) {
- emitDebugRnglists();
+ if (NoRangesPresent())
return;
- }
// Start the dwarf ranges section.
- Asm->OutStreamer->SwitchSection(
- Asm->getObjFileLowering().getDwarfRangesSection());
+ MCSymbol *TableEnd = nullptr;
+ if (getDwarfVersion() >= 5) {
+ Asm->OutStreamer->SwitchSection(
+ Asm->getObjFileLowering().getDwarfRnglistsSection());
+ TableEnd = emitRnglistsTableHeader(Asm, useSplitDwarf() ? SkeletonHolder
+ : InfoHolder);
+ } else
+ Asm->OutStreamer->SwitchSection(
+ Asm->getObjFileLowering().getDwarfRangesSection());
// Grab the specific ranges for the compile units in the module.
for (const auto &I : CUMap) {
@@ -2173,6 +2160,9 @@ void DwarfDebug::emitDebugRanges() {
for (const RangeSpanList &List : TheCU->getRangeLists())
emitRangeList(Asm, TheCU, List);
}
+
+ if (TableEnd)
+ Asm->OutStreamer->EmitLabel(TableEnd);
}
void DwarfDebug::handleMacroNodes(DIMacroNodeArray Nodes, DwarfCompileUnit &U) {
@@ -2248,9 +2238,6 @@ void DwarfDebug::initSkeletonUnit(const
SkeletonHolder.addUnit(std::move(NewU));
}
-// This DIE has the following attributes: DW_AT_comp_dir, DW_AT_stmt_list,
-// DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, DW_AT_dwo_name, DW_AT_dwo_id,
-// DW_AT_addr_base, DW_AT_ranges_base or DW_AT_rnglists_base.
DwarfCompileUnit &DwarfDebug::constructSkeletonCU(const DwarfCompileUnit &CU) {
auto OwnedUnit = llvm::make_unique<DwarfCompileUnit>(
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=337981&r1=337980&r2=337981&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Jul 25 16:03:22 2018
@@ -423,8 +423,13 @@ class DwarfDebug : public DebugHandlerBa
void initSkeletonUnit(const DwarfUnit &U, DIE &Die,
std::unique_ptr<DwarfCompileUnit> NewU);
- /// Construct the split debug info compile unit for the debug info
- /// section.
+ /// Construct the split debug info compile unit for the debug info section.
+ /// In DWARF v5, the skeleton unit DIE may have the following attributes:
+ /// DW_AT_addr_base, DW_AT_comp_dir, DW_AT_dwo_name, DW_AT_high_pc,
+ /// DW_AT_low_pc, DW_AT_ranges, DW_AT_stmt_list, and DW_AT_str_offsets_base.
+ /// Prior to DWARF v5 it may also have DW_AT_GNU_dwo_id. DW_AT_GNU_dwo_name
+ /// is used instead of DW_AT_dwo_name, Dw_AT_GNU_addr_base instead of
+ /// DW_AT_addr_base, and DW_AT_GNU_ranges_base instead of DW_AT_rnglists_base.
DwarfCompileUnit &constructSkeletonCU(const DwarfCompileUnit &CU);
/// Emit the debug info dwo section.
Modified: llvm/trunk/test/DebugInfo/X86/cu-ranges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/cu-ranges.ll?rev=337981&r1=337980&r2=337981&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/cu-ranges.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/cu-ranges.ll Wed Jul 25 16:03:22 2018
@@ -5,6 +5,9 @@
; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
; RUN: llvm-dwarfdump -debug-abbrev %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s
+; RUN: llc -dwarf-version=5 -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llvm-dwarfdump -v %t | FileCheck --check-prefix=DWARF5 %s
+
; From:
; int foo (int a) {
; return a+1;
@@ -24,6 +27,14 @@
; NO-FUNCTION-SECTIONS: DW_AT_low_pc DW_FORM_addr
; NO-FUNCTION-SECTIONS-NOT: DW_AT_ranges
+; For Dwarf 5 check that we neither generate DW_AT_rnglists_base for the CU DIE nor
+; a .debug_rnglists section. There is only 1 CU range with no scope ranges.
+;
+; DWARF5: .debug_info contents:
+; DWARF5: DW_TAG_compile_unit
+; DWARF5-NOT: DW_AT_rnglists_base [DW_FORM_sec_offset]
+; DWARF5-NOT: .debug_rnglists contents:
+
; Function Attrs: nounwind uwtable
define i32 @foo(i32 %a) #0 !dbg !4 {
entry:
Added: llvm/trunk/test/DebugInfo/X86/rnglists_base_attr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/rnglists_base_attr.ll?rev=337981&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/rnglists_base_attr.ll (added)
+++ llvm/trunk/test/DebugInfo/X86/rnglists_base_attr.ll Wed Jul 25 16:03:22 2018
@@ -0,0 +1,89 @@
+; RUN: llc -dwarf-version=5 -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llvm-dwarfdump -v %t | FileCheck %s
+
+; Make sure we don't generate a duplicate DW_AT_rnglists_base attribute in the CU DIE
+; when more than one range list is emitted.
+; From the source:
+;
+; void f1();
+; void f2() {
+; f1();
+; {
+; bool b;
+; f1();
+; f1();
+; }
+; }
+; __attribute__((section(".text.foo"))) void f3() { }
+
+; Compile with clang -gwarf5 -S -emit-llvm
+; and change the resulting IR to move the first call to f1() to between
+; the second and the third call. This, along with the dbg.declare instruction
+; for the variable b, creates a gap in the code range for the nested lexical
+; scope that is b's immediate parent scope. A range list is emitted for that scope.
+;
+; In addition, the placement of f3() in a different section forces a
+; rangelist to be emitted for the CU instead of simply using low/high pc
+; attributes.
+
+; CHECK: .debug_info contents:
+; CHECK: DW_TAG_compile_unit
+; Make sure we have 2 CU ranges.
+; CHECK: DW_AT_ranges
+; CHECK-NEXT: [0x{{[0-9a-f]+, 0x[0-9a-f]+}}) ".text"
+; CHECK-NEXT: [0x{{[0-9a-f]+, 0x[0-9a-f]+}}) ".text.foo"
+; We should not see any duplicate DW_AT_rnglists_base attributes.
+; CHECK: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)
+; CHECK-NOT: DW_AT_rnglists_base
+;
+; Make sure we see 2 ranges in the lexical block DIE.
+; CHECK: DW_TAG_lexical_block
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_ranges
+; CHECK-NEXT: [0x{{[0-9a-f]+, 0x[0-9a-f]+}}) ".text"
+; CHECK-NEXT: [0x{{[0-9a-f]+, 0x[0-9a-f]+}}) ".text"
+
+define dso_local void @_Z2f2v() !dbg !7 {
+entry:
+ %b = alloca i8, align 1
+ call void @llvm.dbg.declare(metadata i8* %b, metadata !11, metadata !DIExpression()), !dbg !14
+ call void @_Z2f1v(), !dbg !15
+ ; The following call has been moved here from right after the alloca
+ call void @_Z2f1v(), !dbg !10
+ call void @_Z2f1v(), !dbg !16
+ ret void, !dbg !17
+}
+
+declare dso_local void @_Z2f1v()
+
+declare void @llvm.dbg.declare(metadata, metadata, metadata)
+
+define dso_local void @_Z2f3v() section ".text.foo" !dbg !18 {
+entry:
+ ret void, !dbg !19
+}
+
+!llvm.dbg.cu<http://llvm.dbg.cu> = !{!0}
+!llvm.module.flags = !{!3, !4, !5}
+!llvm.ident = !{!6}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 7.0.0 (trunk 337837)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+!1 = !DIFile(filename: "t3.cpp", directory: "/home/test/rangelists", checksumkind: CSK_MD5, checksum: "1ba81b564a832caa8114cd008c199048")
+!2 = !{}
+!3 = !{i32 2, !"Dwarf Version", i32 5}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 4}
+!6 = !{!"clang version 7.0.0 (trunk 337837)"}
+!7 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
+!8 = !DISubroutineType(types: !9)
+!9 = !{null}
+!10 = !DILocation(line: 3, column: 3, scope: !7)
+!11 = !DILocalVariable(name: "b", scope: !12, file: !1, line: 5, type: !13)
+!12 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 3)
+!13 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean)
+!14 = !DILocation(line: 5, column: 10, scope: !12)
+!15 = !DILocation(line: 6, column: 5, scope: !12)
+!16 = !DILocation(line: 7, column: 5, scope: !12)
+!17 = !DILocation(line: 9, column: 1, scope: !7)
+!18 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !1, file: !1, line: 10, type: !8, isLocal: false, isDefinition: true, scopeLine: 10, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
+!19 = !DILocation(line: 10, column: 51, scope: !18)
Added: llvm/trunk/test/DebugInfo/X86/rnglists_curanges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/rnglists_curanges.ll?rev=337981&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/rnglists_curanges.ll (added)
+++ llvm/trunk/test/DebugInfo/X86/rnglists_curanges.ll Wed Jul 25 16:03:22 2018
@@ -0,0 +1,50 @@
+; RUN: llc -dwarf-version=5 -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
+; RUN: llvm-dwarfdump -v %t | FileCheck %s
+;
+; Check that we generate DW_AT_rnglists_base in the CU die, as well as a range
+; list table when we have more than 1 CU range and no scope range.
+;
+; Generated from:
+;
+; __attribute__((section("text.foo"))) void f1() {}
+; __attribute__((section("text.bar"))) void f2() {}
+;
+; Compile with clangc -gdwarf-5 -O0 -S -emit-llvm
+;
+; CHECK: .debug_info contents:
+; CHECK: DW_TAG_compile_unit
+; CHECK-NOT: DW_TAG
+; CHECK: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)
+; CHECK: .debug_rnglists contents:
+; CHECK: 0x00000000: range list header: length = 0x0000001d, version = 0x0005,
+; CHECK-SAME: addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
+
+; Function Attrs: noinline nounwind optnone uwtable
+define dso_local void @f1() section "text.foo" !dbg !7 {
+entry:
+ ret void, !dbg !10
+}
+
+; Function Attrs: noinline nounwind optnone uwtable
+define dso_local void @f2() section "text.bar" !dbg !11 {
+entry:
+ ret void, !dbg !12
+}
+
+!llvm.dbg.cu<http://llvm.dbg.cu> = !{!0}
+!llvm.module.flags = !{!3, !4, !5}
+!llvm.ident = !{!6}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0 (trunk 337470)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+!1 = !DIFile(filename: "test3.c", directory: "/home/test/rangelists", checksumkind: CSK_MD5, checksum: "f3b46bc2e5bc55bdd511ae4ec29577b6")
+!2 = !{}
+!3 = !{i32 2, !"Dwarf Version", i32 5}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 4}
+!6 = !{!"clang version 7.0.0 (trunk 337470)"}
+!7 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, retainedNodes: !2)
+!8 = !DISubroutineType(types: !9)
+!9 = !{null}
+!10 = !DILocation(line: 1, column: 49, scope: !7)
+!11 = distinct !DISubprogram(name: "f2", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, retainedNodes: !2)
+!12 = !DILocation(line: 2, column: 49, scope: !11)
_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180731/87c06d52/attachment.html>
More information about the llvm-commits
mailing list