dwarflint versus linkage_name attributes

Dodji Seketeli dodji at redhat.com
Mon Apr 4 19:51:20 UTC 2011


Roland McGrath <roland at hack.frob.com> writes:

>> There is actually a comment in the source code:
>> 
>>       /* This is a GNU Extension.  We are adding a
>> 	 DW_AT_linkage_name attribute to the DIE of the
>> 	 anonymous struct TYPE.  The value of that attribute
>> 	 is the name of the typedef decl naming the anonymous
>> 	 struct.  This greatly eases the work of consumers of
>> 	 this debug info.  */
>
> Because the typedef name is what contributes to the mangled name of its
> methods?

Yes.  And more importantly because the name of the constructor of the
anonymous struct is the name of the naming typedef.  [I now believe this
is a bug, though.]  So this was breaking GDB because it wouldn't figure
easily the relationship between the constructor (which name is, e.g,
't') and the anonymous struct which name is, well, anonymous.  So adding
the linkage name attribute [which value is 't'] was the easier way [from
GDB's standpoint] to help fix the issue.

Tom, please stop me right there if I am saying garbage :-)

>  I still don't understand why there isn't just a linkage_name on
> each method (including the anonymous constructor methods).

I thought about this too, and Jason agrees[1].  The correct solution
wold be to:

     1/ Change the name of the constructor from 't' to an anonymous value
     2/ Add a linkage_name attribute to all the methods including the constructor

AIUI, we'd need to coordinate with GDB for this b/c otherwise this (at
least 1/) would break GDB again.

[1]: http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00926.html

-- 
		Dodji


More information about the elfutils-devel mailing list