[PATCH] D46878: Add DW_AT_linkage_name for DW_TAG_labels

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 22 11:10:14 PDT 2018


probinson added inline comments.


================
Comment at: lib/MC/MCDwarf.cpp:562
   EmitAbbrev(MCOS, dwarf::DW_AT_name, dwarf::DW_FORM_string);
+  EmitAbbrev(MCOS, dwarf::DW_AT_linkage_name, dwarf::DW_FORM_string);
   EmitAbbrev(MCOS, dwarf::DW_AT_decl_file, dwarf::DW_FORM_data4);
----------------
aprantl wrote:
> JohnReagan wrote:
> > Uh, DW_AT_linkage_name isn't intended to be used with DW_TAG_labels.  It is really meant to provide the mangled names with entries, etc.  From DWARF4 spec
> > 
> > "Debugging information entries to which DW_AT_linkage_name may apply include: DW_TAG_common_block, DW_TAG_constant, DW_TAG_entry_point, DW_TAG_subprogram and DW_TAG_variable."
> > 
> > DWARF5 dropped that wording, but you can still infer that list from Appendix A, etc.
> > 
> > I can see that we already emit DW_AT_prototyped for DW_TAG_labels (also extra to the standard).
> > 
> > There are other debuggers who consume this stuff.  We're about to start work on the OpenVMS debugger to bring it up past DWARF3 and I would have assumed (incorrectly) that nobody would emit these DW_AT_ attributes for labels.
> > 
> > Is there a document somewhere that tracks these extra-standard extensions?
> > 
> > 
> > DWARF5 dropped that wording, but you can still infer that list from Appendix A, etc.
> I wonder if the information in Appendix A (which is non-normative) isn't an oversight. Might be worth bringing this up on the dwarf-discuss mailing list.
> 
> > Is there a document somewhere that tracks these extra-standard extensions?
> Not that I'm aware of. Generally LLVM tends to be fairly permissive about emitting extra dwarf attributes based on that consumers can always ignore extra attributes they don't understand.
Appendix A is really a best-effort list, not definitive (which is explicitly stated in the opening text of the appendix).  DWARF rarely mandates anything, and permissively allows extra attributes not specified in the normative text to appear in a DIE.  Any reader needs to be ready for that sort of thing.
In the case at hand, it seems there are situations where the label's name in the source text is not the same as the name exposed to the linker, and that's pretty much exactly what DW_AT_linkage_name is for.  I might prefer that the extra attribute appear only when needed, but we don't make a huge effort to support the best possible debug info for assembler source (which is the case here).


https://reviews.llvm.org/D46878





More information about the llvm-commits mailing list