This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen/AccelTable]: Don't emit accelerator entries for functions with no names
ClosedPublic

Authored by labath on Apr 6 2018, 6:55 AM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Apr 6 2018, 6:55 AM
labath added inline comments.Apr 6 2018, 6:57 AM
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
389–391 ↗(On Diff #141337)

I'm not sure what this TODO here is trying to say, but it could be that this patch resolves it...

labath updated this revision to Diff 141338.Apr 6 2018, 6:58 AM

Fix a CHECK stanza in the test.

JDevlieghere accepted this revision.Apr 6 2018, 7:38 AM

I agree, let's keep the linkage name in there. LGTM.

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
389–391 ↗(On Diff #141337)

Sounds like it :-)

This revision is now accepted and ready to land.Apr 6 2018, 7:38 AM
labath marked 2 inline comments as done.Apr 9 2018, 1:35 AM
labath added inline comments.
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
389–391 ↗(On Diff #141337)

OK, I'll remove it.

This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.