This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: advice needed regarding c++ name mangling
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Razya Ladelsky <RAZYA at il dot ibm dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc at gcc dot gnu dot org, Nathan Sidwell <nathan at codesourcery dot com>
- Date: Sun, 13 Mar 2005 10:31:04 -0500
- Subject: Re: advice needed regarding c++ name mangling
- References: <OFD0A4B4CB.56DEE1F0-ONC2256FC3.002F4C35-C2256FC3.002FA00E@il.ibm.com>
On Sun, 2005-03-13 at 10:54 +0200, Razya Ladelsky wrote:
> Mark Mitchell <mark@codesourcery.com> wrote on 11/03/2005 04:55:38:
>
> > Daniel Berlin wrote:
> >
> > > As for why the new name doesn't work, it's not clear from the above.
> > > I'd need to see the assembly and the error.
> > > :)
> >
> > Likewise. I assume these functions have only internal linkage? Or that
>
> > the original function is still provided with external linkage? (I'm
> > just checking that we're not breaking the ABI.)
> >
>
> These functions indeed have only internal linkage.
> The error I get is :
>
> /tmp/cc9VryOe.s: Assembler messages:
> /tmp/cc9VryOe.s:11056: Error: unrecognized symbol type ""
> /tmp/cc9VryOe.s:11056: Warning: rest of line ignored; first ignored
> character is `<'
> /tmp/cc9VryOe.s:11057: Error: Unrecognized opcode: `operator<<.589:'
> /tmp/cc9VryOe.s:11392: Error: expected comma after name `operator' in
> .size directive
> /tmp/cc9VryOe.s:11392: Warning: rest of line ignored; first ignored
> character is `<'
> /tmp/cc9VryOe.s:11444: Error: unrecognized symbol type ""
> /tmp/cc9VryOe.s:11444: Warning: rest of line ignored; first ignored
> character is `<'
> /tmp/cc9VryOe.s:11445: Error: Unrecognized opcode: `operator<<.585:'
> /tmp/cc9VryOe.s:11849: Error: expected comma after name `operator' in
> .size directive
> /tmp/cc9VryOe.s:11849: Warning: rest of line ignored; first ignored
> character is `<'
>
>
> the relevant assembly code (a similar assembly is produced for happens
> for operator<<.589):
>
>
> .section
> .text._ZNSt13basic_ostreamIN9__gnu_cxx9characterItj11__mbstate_tEESt11char_traitsIS3_EElsEb
> .section
> .text._ZNSt13basic_ostreamIN9__gnu_cxx9characterItj11__mbstate_tEESt11char_traitsIS3_EElsEl,"ax",@progbits
> .align 2
> .type operator<<.585, @function
> operator<<.585:
> .LFB3983:
> .loc 22 125 0
> .LVL864:
> mflr 0
> .LCFI384:
> stwu 1,-96(1)
> .....
>
> The caller's part:
> ......
> .LEHE165:
> mr 3,31
> bl _ZNSt6localeD1Ev
> .LBB4727:
> .loc 14 98 0
> mr 3,25
> li 4,500
> .LEHB166:
> bl operator<<.585
^^^^^^^^^^^^^^^^^^^
You are using the demangled name instead of the mangled one, which is
where your problem comes from.
Mark should be able to tell you how to get the mangled name instead of
the demangled one (though i thought it was just in either
DECL_ASSEMBLER_NAME or DECL_NAME).
--Dan