diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-09-03 12:12:17 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-09-03 12:12:17 +0000 |
| commit | 6e5c7e6037a43c42efa9d3a2af2704322f704824 (patch) | |
| tree | 17b661586108f464504d81af9d161b34ccfeb9aa /llvm/lib | |
| parent | 5c984fb16d7d27c3522cf7eeb1b1805e867af499 (diff) | |
| download | bcm5719-llvm-6e5c7e6037a43c42efa9d3a2af2704322f704824.tar.gz bcm5719-llvm-6e5c7e6037a43c42efa9d3a2af2704322f704824.zip | |
[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
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
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<StringRef, 2> getNames(const DWARFDie &DIE) { +static SmallVector<StringRef, 2> getNames(const DWARFDie &DIE, + bool IncludeLinkageName = true) { SmallVector<StringRef, 2> 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; |

