Daniel Berlin writes >Do you really want me to sit here and knock down every single one of >your arguments?
Why would you think I would've wanted your "No, it isn't" responses instead? >Your functions you are trying to optimize for multiple cpu >types and compiled with different flags may be output as linkonce >functions. The linker is simply going to pick one, regardless of what >CPU architecture or assembly it generated... No, in the example I gave, the functions have different names. >The fact is that Microsoft's implementation rarely generates >significant savings over that given by linkonce functions, and when >it does, it will in no way compare to anything that does *more* than >stupid byte comparisons will give you. No, "linkonce" function discarding is always done by the Microsoft toolchain and can't be disabled. The reported savings are the result of comparing the results of enabling and disabling identical COMDAT folding. I don't see how your "intelligent" hashing can do significantly better except by merging functions that aren't really identical. >That's nice. It's the only way to do it sanely and correctly in all >cases, without having to teach the linker how to look at code, or to >control the linker (which we don't on some platforms), and output a >side channel explaining what it is allowed to eliminate, at which >point, you might as well do it in the compiler! How does hashing the RTL and using that as the COMDAT label solve this problem? You're telling the linker you know it's safe to merge when you don't know if the function's address is compared in another compilation unit or not. >You can believe what you like about the idea. Until you are willing >to implement something *you* believe will help, or at the least >explain how you forsee it being done safely (which Microsoft >doesn't!), it's very hard to take you seriously As I've already said, it can be made safe by communicating to the linker which functions have had their address taken. Yes, this requires special support from the linker, but then so has linkonce on some platforms. If that special support isn't available you're still left with an unsafe but very useful optimization for applications that don't compare function pointers. Ross Ridge