Jerry Quinn wrote: > > OK, I'm now confused. How does this dovetail with anonymous > namespaces?
We're talking about typeinfo strings. The namespace is part of the typeinfo name string (the so-called NTBS name), and it's the random number in the anonymous namespace name used for these local definitions that is varying between stages 2 and 3 and causing the bootstrap comparison failure, if I've been following the thread correctly. > Richard's suggestion was to avoid mangling the name at all and relying > on pointers being different to distinguish between the anonymous > namespaces in different translation units. Yep, and to put an asterisk at the start of the NTBS name to indicate that it can only be used for pointer comparison. > If I understand correctly, the main thing we want is for libstdc++ to > consider two typeinfos the same if they are the same type in the same > file's anonymous namespace, but different if they have the same name but > came from different files. Yep, that's the idea. > I'm unclear how the symbols in the asm get turned into typeinfos, and > thus how the transform needs to be done. It's the other way round. The typeinfo names and structs are constructed based on the C++ decl tree structs for the type in question, and then assigned an asm name according to the cxx-abi rules. Your patch puts the asterisk into the namespace identifier decl, so it ends up in both the rtti NTBS name string, and also in the generated asm name for the objects. What I think you need to do is use an identifier for the anonymous namespace without an asterisk, but prefix the asterisk when generating the corresponding NTBS name string; then your changes to the name comparison routines in libsupc++ should work, but the typeinfo name string won't have any funny chars in it. You might also need to take steps to ensure that the typeinfo gets emitted as non-COMDAT with local symbols, so that each object does indeed end up with its own separate copy. cheers, DaveK