Bug 31462 - Unnamed namespace and exported symbols
Summary: Unnamed namespace and exported symbols
Status: RESOLVED DUPLICATE of bug 25915
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.2
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-03 17:09 UTC by Guillaume Melquiond
Modified: 2007-04-03 20:03 UTC (History)
14 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Melquiond 2007-04-03 17:09:08 UTC
(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.
Comment 1 Andrew Pinski 2007-04-03 20:03:35 UTC
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 ***