From 6e5c7e6037a43c42efa9d3a2af2704322f704824 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 3 Sep 2018 12:12:17 +0000 Subject: [DebugInfo] Have the verifier accept missing linkage names. According to the standard, for the .debug_names (the "dwarf accelerator tables"): > If a subprogram or inlined subroutine is included, and has a > DW_AT_linkage_name attribute, there will be an additional index entry > for the linkage name. For Swift we generate DW_structure_types with a linkage name and the verifier was incorrectly rejecting this. This patch fixes that by only considering the linkage name in those particular cases. The test is the "reduced" debug info of the failing swift test on swift.org. Differential revision: https://reviews.llvm.org/D51420 llvm-svn: 341311 --- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index b8b876879e9..1f0ac6f344b 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -1059,16 +1059,19 @@ DWARFVerifier::verifyNameIndexAbbrevs(const DWARFDebugNames::NameIndex &NI) { return NumErrors; } -static SmallVector getNames(const DWARFDie &DIE) { +static SmallVector getNames(const DWARFDie &DIE, + bool IncludeLinkageName = true) { SmallVector Result; if (const char *Str = DIE.getName(DINameKind::ShortName)) Result.emplace_back(Str); else if (DIE.getTag() == dwarf::DW_TAG_namespace) Result.emplace_back("(anonymous namespace)"); - if (const char *Str = DIE.getName(DINameKind::LinkageName)) { - if (Result.empty() || Result[0] != Str) - Result.emplace_back(Str); + if (IncludeLinkageName) { + if (const char *Str = DIE.getName(DINameKind::LinkageName)) { + if (Result.empty() || Result[0] != Str) + Result.emplace_back(Str); + } } return Result; @@ -1211,7 +1214,9 @@ unsigned DWARFVerifier::verifyNameIndexCompleteness( // "If a subprogram or inlined subroutine is included, and has a // DW_AT_linkage_name attribute, there will be an additional index entry for // the linkage name." - auto EntryNames = getNames(Die); + auto IncludeLinkageName = Die.getTag() == DW_TAG_subprogram || + Die.getTag() == DW_TAG_inlined_subroutine; + auto EntryNames = getNames(Die, IncludeLinkageName); if (EntryNames.empty()) return 0; -- cgit v1.2.3