From 9d08d69fd4562a4433cf19eb4b96c17b34f6da2e Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Thu, 3 Oct 2013 08:54:43 +0000 Subject: Remove wild .debug_aranges entries generated from unimportant labels r191052 added emitting .debug_aranges to Clang, but this functionality is broken: it uses all MC labels added in DWARF Asm printer, including the labels for build relocations between different DWARF sections, like .Lsection_line or .Ldebug_loc0. As a result, if any DIE .debug_info would contain "DW_AT_location=0x123" attribute, .debug_aranges would also contain a range starting from 0x123, breaking tools that rely on this section. This patch fixes this by using only MC labels that corresponds to the addresses in the user program. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191884 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp') diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 587ee35..b8fa974 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1110,8 +1110,8 @@ void DwarfDebug::finalizeModuleInfo() { void DwarfDebug::endSections() { // Filter labels by section. - for (size_t n = 0; n < Labels.size(); n++) { - const SymbolCU &SCU = Labels[n]; + for (size_t n = 0; n < ArangeLabels.size(); n++) { + const SymbolCU &SCU = ArangeLabels[n]; if (SCU.Sym->isInSection()) { // Make a note of this symbol and it's section. const MCSection *Section = &SCU.Sym->getSection(); @@ -1138,10 +1138,7 @@ void DwarfDebug::endSections() { } // Insert a final terminator. - SymbolCU Entry; - Entry.CU = NULL; - Entry.Sym = Sym; - SectionMap[Section].push_back(Entry); + SectionMap[Section].push_back(SymbolCU(NULL, Sym)); } } -- cgit v1.1