>>> Is there a format for compiler-defined labels that would not be able >>> to clash with other user-generated labels? >> >> My understanding is that the "." in the generated name ensures that it >> will not clash with user-generated labels which cannot contain ".". So >> this should not be an issue. > > Is that true for all languages? I don't think we can make that > assumption. Also, there may be clashes with other compiler generated > symbols. I know of at least one Fortran compiler that composes names > for module symbols as "modulename.symbolname", and if symbolname is > "cold" then you can have a clash.
GCC already uses "." to generate names for cloned functions, and picks a different separator for targets where "." is legal (see clone_function_name in cgraphclones.c). It would probably be a good idea to use clone_function_name to generate the new name (in particular, because the C++ demangler already knows how to handle that style when it's applied to mangled names). -cary