Name mangling

Christophe de Dinechin ddd at cup.hp.com
Mon Oct 18 22:33:06 UTC 1999


> Entities with linkable names
> ----------------------------
> .. functions and members functions (including operators)
> .. namespace scope variables and static data members
> .. virtual function tables
> .. any auxiliary tables used for installing construction vtables
> .. RTTI structures (std::type_info derivations)
> .. EH structures?
>
> For entities with C name linkage, the entity's linkable name is  
identical to
> its base name (as usual).
>
>

Entities with no linkable name, but which need to be referenced  
accross translation units (inlining, template instantiations):

1. String constants
2. Static local variables

Note that to enable a "compiler-driven" inlining, these need to be  
named inside any function, not only inline ones.


> Such entities' linkable name must include at least:
>   . an encoding of the base name (presumably, the base name itself) 
>   . an encoding of the declarative scope (classes and namespaces), when 
>     applicable

Note the special case of anonymous namespaces. We don't need to  
agree on the unique name generation, but it may be useful to agree on  
its structure.

>
> In addition, it may be desirable to encode the following components: 
>   . the variable's type (possibly including exception specifications) 

For variable size, we may have a problem with array sizes. What  
about linking:

foo.C:	extern int a[10];
bar.C:	int a[200000];

Problem: short data space. the declaration in foo.C may seem like a  
good 'short' candidate, whereas the definition is not.


Regards
Christophe




More information about the cxx-abi-dev mailing list