Updated mangling specs

Jason Merrill jason at cygnus.com
Tue Feb 22 20:56:15 UTC 2000


>>>>> Christophe de Dinechin <ddd at cup.hp.com> writes:

 > // File f1.C

 > static inline int foo()
 > {
 > 	static int i = 0;
 > 	return ++i;
 > }

 > extern int bar1()
 > {
 > 	return foo();
 > }

 > [snip]

 > Consider what happens if you want to inline bar1 and bar2. Our name
 > mangling for statics is not good enough, because i would be mangled the
 > same. We need a file name too. To me, it's good enough to use the
 > 'escape' mechanism for that, but it has to be there.

Ah, I see.

The mangling specs define the mangling for things with external linkage;
for our purposes, a static local in an inline function with external
linkage also has external linkage.  In the situation you describe, foo::i
has internal linkage, but is promoted to external linkage via cross-module
inlining.

We could define what to do in this case, or we could just say that the
inliner should rename the symbol appropriately.

Jason




More information about the cxx-abi-dev mailing list