(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.
--
Summary: Unnamed namespace and exported symbols
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: guillaume dot melquiond at ens-lyon dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31462