I've experimented with adding DW_AT_linkage_name for composite types in LLVM. Here is impact on binary sizes (compiled with debuginfo):
Original size with DW_AT_linkage_name for composites % increase clang-7.0 1926574256 1952846192 1.4% clang-tidy 1220980360 1238498112 1.4% llvm-mt 7404728 7525328 1.6% cout<<"hello"; 21552 22080 2.4% -Roman 2018-03-02 15:06 GMT-08:00 Roman Popov <ripo...@gmail.com>: > Ok, sounds reasonable. In case of debugger we are indeed "linking" RTTI > name with name in debuginfo. > > I've checked LLVM docs, they generate Debuginfo from LLVM "Metadata", and > metadata for types already contains mangled names in "identifier" field: > https://llvm.org/docs/LangRef.html#dicompositetype . So it should not be > hard to propagate it to object file. > > I will ask on LLVM maillist if they can emit it. > > > 2018-03-01 13:03 GMT-08:00 Jason Merrill <ja...@redhat.com>: > >> On Thu, Mar 1, 2018 at 3:26 PM, Andrew Pinski <pins...@gmail.com> wrote: >> > On Thu, Mar 1, 2018 at 12:18 PM, Roman Popov <ripo...@gmail.com> wrote: >> >> Is there any progress on this problem? >> >> >> >> I'm not familiar with G++ , but I have little experience with LLVM. I >> can >> >> try make LLVM emitting mangled names to DW_AT_name, instead of >> demangled >> >> ones. >> >> This way GDB can match DW_AT_name against RTTI. And for display it can >> >> call abi::__cxa_demangle(name, NULL, NULL, &status), from #include >> >> <cxxabi.h>. >> >> >> >> Will it work? >> > >> > >> > Reading http://wiki.dwarfstd.org/index.php?title=Best_Practices: >> > the DW_AT_name attribute should contain the name of the corresponding >> > program object as it appears in the source code, without any >> > qualifiers such as namespaces, containing classes, or modules (see >> > Section 2.15). A consumer can easily reconstruct the fully-qualified >> > name from the DIE hierarchy. In general, the value of DW_AT_name >> > should be such that a fully-qualified name constructed from the >> > DW_AT_name attributes of the object and its containing objects will >> > uniquely represent that object in a form natural to the source >> > language. >> > >> > >> > So having the mangled symbol in DW_AT_name seems backwards and not the >> > point of it. >> >> If we add the mangled name, which seems reasonable, it should be in >> DW_AT_linkage_name. >> >> Jason >> > >