This fixes a bug introduced in r340041 (see the discussion in https://reviews.llvm.org/D50783).
'@' can't be used in block descriptors' symbol names since it is reserved on ELF platforms as a separator between symbol names and symbol versions.
I don't know of any forbidden symbols on Windows PE/COFF symbols, but if there are, I can make changes similar to the ones I made in this patch.
I'm not sure that this actually belongs in CGObjCRuntime. The runtime doesn't care about the symbol namings, and the need for this mangling applies to any ELF platform (it would also apply to Mach-O if Mach-O adopted GNU-style symbol versioning). It probably isn't relevant, for example, with WebAssembly, irrespective of the runtime, and it would be relevant for the Apple family of runtimes if anyone wanted to use them on ELF.
If it does go in CGObjCRuntime, I think I'd prefer to have the implementation there as well and make it conditional on the object format, not on the runtime. Having a function that maps Objective-C type encodings to valid symbol names in CGObjCRuntime would let us do a little bit of cleanup in CGObjCGNU* and could also be used in the blocks code.