Issue 090715.1: Add a DW_AT_linkage_name attribute
Background
----------
A vendor defined attribute DW_AT_MIPS_linkage_name has been in use
for many years by various implementations. This proposal seeks to
standardize this industry practice within DWARF.
Proposal
--------
1) In Table 1, add an entry for
DW_AT_linkage_name Object language name for an entity
2) Add a new Section as follows:
2.22 Linkage Names
*Some language implementations, notably for C++ and similar
languages, make use of implemntation defined object file
names that are different from the names of entities as they
appear in the source. Such names, sometimes known as mangled names,
are used in various ways, including: to encode additional information
about an entity, to distinguish multiple entities that have the same
name, and so on. When an entity has an associated distinct linkage name
it may sometimes be useful for a producer to include this name
in the DWARF description of the program to facilitate consumer
access to and use of object file information about an entity
and/or information that is encoded in the linkage name itself.*
Entities that may reference or be referenced across compilation
unit boundaries may have a DW_AT_linkage_name attribute whose
value is a null-terminated string describing the implementation
defined linkage name associated with the entity.
If the object file name for an entity is the same as the name in
the source program, then a linkage name attribute is omitted.
*Debugging information entries to which DW_AT_linkage_name may
apply include: DW_TAG_constant, DW_TAG_entry_point,
DW_TAG_subprogram and DW_TAG_variable.*
3) In Section 3.3.1. General Subroutine and Entry Point Information,
insert after the second paragraph:
If the name of a subprogram or entry point described by an entry
with the tag DW_TAG_subprogram or DW_TAG_entry_point is visible
outside of its containing compilation unit, it may have a
DW_AT_linkage_name attribute as described in Section 2.22.
4) In Section 4.1, Data Object Entries, add a new list item at the
end:
14. If the name of a varable or constant is visible outside
of its enclosing compilation unit, the entity may have a
DW_AT_linkage_name attribute as described in Section 2.22.
5) In Figure 20. Attribute Encodings, add
DW_AT_linkage_name 0x6d string
6) In Appendix A, Figure 42, add DW_AT_linkage_name as an applicable
attribute for
DW_TAG_constant
DW_TAG_entry_point
DW_TAG_subprogram
DW_TAG_variable
Discussion
----------
An earlier proposal [090503.1] adding linkage name DWARF operators for
use in location expressions. There was some support for this in
addition to a linkage name attribute, but little support for such
operators alone. Further, operators were generally perceived to be
potentially useful but currently a solution looking for a problem.
This proposal deliberately says nothing about how linkage names are
formed and/or used. That is left for implementations to determine.
Note that linkage name attributes are never required by DWARF, even
in implementations that use mangled names.
--
August 11, 2009 -- Accepted with following replacement non-normative
text: "Entities may have a DW_AT__linkage_name whose attribute is a
null terminated string which describes the implementation defined
name associated with the entity."