OSDN Git Service

[CodeGen/AccelTable]: Don't emit accelerator entries for functions with no names
authorPavel Labath <labath@google.com>
Mon, 9 Apr 2018 08:41:57 +0000 (08:41 +0000)
committerPavel Labath <labath@google.com>
Mon, 9 Apr 2018 08:41:57 +0000 (08:41 +0000)
commit099f934b4f04ab6654428bc634eadaec21b3eb91
treedba38ca8e3216cfa36649626849ffc90ae0712ed
parent3757f28f1d540076d703a8b032bdbe7cc23f003a
[CodeGen/AccelTable]: Don't emit accelerator entries for functions with no names

Summary:
We were emitting accelerator entries for functions with no name, which
is contrary to the DWARF v5 spec: "All other (i.e., *not*
DW_TAG_namespace) debugging information entries without a DW_AT_name
attribute are excluded." Besides that, a name table entry with an empty
string as a key is fairly useless.

We can sometimes end up with functions which have a DW_AT_linkage_name but no
DW_AT_name. One such example is the global-constructor-initialization functions,
which C++ compilers synthesize for each compilation unit with global
constructors.
A very strict reading of the DWARF v5 spec would suggest that we should not even
emit the accelerator entry for the linkage name in this case, but I don't think
we should go that far.

I found this when running the dwarf verifier over llvm codebase compiled
with DWARF v5 accelerator tables.

Reviewers: JDevlieghere, aprantl, dblaikie

Subscribers: vleschuk, clayborg, echristo, probinson, llvm-commits

Differential Revision: https://reviews.llvm.org/D45367

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329552 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/Generic/debug-names-empty-name.ll [new file with mode: 0644]