This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch/RFC] link_name attribute to alter the mangling of class types
- From: Doug Gregor <dgregor at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 18 Jul 2003 11:41:43 -0700
- Subject: [Patch/RFC] link_name attribute to alter the mangling of class types
This patch adds a new type attribute for the C++ front end called
link_name. It allows classes to alter their name during name mangling,
so that the name used in the C++ source can appear differently in the
output. Here's a short example:
class __attribute__((__link_name__("bar"))) foo {};
void do_it(const foo&) {}
The do_it function mangles to the name "_Z5do_itRK3bar", because class
"foo" has a link_name of "bar".
This is the expanded patch mentioned in the second libstdc++ debug mode
patch. It allows the code compiled with the libstdc++ debug mode to
coexist with code compiled without the debug mode (a much-requested
feature!). Testcase, changelog, and documentation included in the
patch. Tested on i686-pc-linux-gnu and powerpc-apple-darwin with no new
regressions.
Would this be okay for mainline, if we decide we need it for libstdc++?
Doug
Attachment:
linkname.patch
Description: Binary data