(NB: I'm not suggesting to change the linkage of functions in an unnamed namespace to internal.) Unless specified otherwise, functions in an unnamed namespace have external linkage. Does that mean that g++ has to export the corresponding symbol? As the function cannot be used from another translation unit, it seems to me it is a waste of space, and perhaps of inter-procedural optimization opportunities too. If there is a case where it matters for the symbol to be exported, please disregard this enhancement-request (but please provide an example as it interests me). The reason for this request is that I recently come across a program where forcefully removing the export of these symbols in the object files sped up executable linking by more than 15%. So it would provide a nice gain if GCC was not exporting the symbols.
This has already been implemented for 4.2.0. See PR 25915 which I am closing this as a dup of. *** This bug has been marked as a duplicate of 25915 ***