Special characters in mangled names

Christophe de Dinechin ddd at cup.hp.com
Mon Nov 15 18:17:42 UTC 1999


> In a discussion with Matt Austern I suggested using a
> collision-resistant hash function on the manglings to generate the 
> names actually used in object files.  (The algorithm is: first mangle, 
> then hash.)  This could really reduce .o size a ton; think expression 
> templates, etc.  I bet this would have a much bigger impact that any 
> obvious compression algorithm; you could just decree that all symbols 
> be no longer than 256 bits long, say.  Lots of tools (assemblers,
> debuggers) will use less space/time dealing with the shorter names. 
> You would keep around a table mapping hashes back to the original
> mangled names for debugging.

Can you please explain what is a "collision-resistant" hash  
function? I doubt you would get the same collisions from two  
different translation units, so I don't see how you could ensure a  
name that is identical between TUs and also avoids collisions.

Also: There is a wide assumption that name mangling is reversible.  
In other words, there is a c++filt tool, and hundreds of scripts use  
it somehow (combined with nm, to process the error output of ld,  
etc.) I'm not sure it is wise to give up this assumption.


Best regards,
Christophe.




More information about the cxx-abi-dev mailing list