public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* why are stl template classes not mangled as other classes and templates
@ 2007-11-26 19:00 Stephane Hockenhull
  2007-11-26 19:08 ` Joe Buck
  0 siblings, 1 reply; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-26 19:00 UTC (permalink / raw)
  To: gcc


hi, it seem stl templates are not mangled as other classes and templates

I was wondering why and where in the g++ source code is that special case 
implemented?

it seem to cause a problem with -fleading-underscore

-- 
Stephane Hockenhull
SSC-Studios.com

PS: why would someone wants to underscore a flea's "ding" is beyond me ;)

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and templates
  2007-11-26 19:00 why are stl template classes not mangled as other classes and templates Stephane Hockenhull
@ 2007-11-26 19:08 ` Joe Buck
  2007-11-26 19:52   ` Stephane Hockenhull
  2007-11-26 19:55   ` Daniel Jacobowitz
  0 siblings, 2 replies; 34+ messages in thread
From: Joe Buck @ 2007-11-26 19:08 UTC (permalink / raw)
  To: Stephane Hockenhull; +Cc: gcc

On Mon, Nov 26, 2007 at 01:33:54PM -0500, Stephane Hockenhull wrote:
> 
> hi, it seem stl templates are not mangled as other classes and templates
> 
> I was wondering why and where in the g++ source code is that special case 
> implemented?
> 
> it seem to cause a problem with -fleading-underscore

AFAIK there is no special case, however there might be a bug lurking
somewhere.  Do you have a specific case where -fleading-underscore messes
up?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and  templates
  2007-11-26 19:08 ` Joe Buck
@ 2007-11-26 19:52   ` Stephane Hockenhull
  2007-11-26 19:55   ` Daniel Jacobowitz
  1 sibling, 0 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-26 19:52 UTC (permalink / raw)
  To: gcc; +Cc: Joe Buck

On Monday 26 November 2007 13:40, Joe Buck wrote:
> On Mon, Nov 26, 2007 at 01:33:54PM -0500, Stephane Hockenhull wrote:
> > hi, it seem stl templates are not mangled as other classes and templates
> >
> > I was wondering why and where in the g++ source code is that special case
> > implemented?
> >
> > it seem to cause a problem with -fleading-underscore
>
> AFAIK there is no special case, however there might be a bug lurking
> somewhere.  Do you have a specific case where -fleading-underscore messes
> up?

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34166

the .stabs section differ from the actual call by 1 underscore prefix

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and  templates
  2007-11-26 19:08 ` Joe Buck
  2007-11-26 19:52   ` Stephane Hockenhull
@ 2007-11-26 19:55   ` Daniel Jacobowitz
  2007-11-26 21:42     ` Joe Buck
  2007-11-27  0:29     ` Stephane Hockenhull
  1 sibling, 2 replies; 34+ messages in thread
From: Daniel Jacobowitz @ 2007-11-26 19:55 UTC (permalink / raw)
  To: Joe Buck; +Cc: Stephane Hockenhull, gcc

On Mon, Nov 26, 2007 at 10:40:35AM -0800, Joe Buck wrote:
> On Mon, Nov 26, 2007 at 01:33:54PM -0500, Stephane Hockenhull wrote:
> > 
> > hi, it seem stl templates are not mangled as other classes and templates
> > 
> > I was wondering why and where in the g++ source code is that special case 
> > implemented?
> > 
> > it seem to cause a problem with -fleading-underscore
> 
> AFAIK there is no special case, however there might be a bug lurking
> somewhere.  Do you have a specific case where -fleading-underscore messes
> up?

There are a few special cases, e.g. for std::string and
std::basic_string; the C++ ABI documents have the details.

_ZSi -> std::basic_istream<char, std::char_traits<char> >


-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and templates
  2007-11-26 19:55   ` Daniel Jacobowitz
@ 2007-11-26 21:42     ` Joe Buck
  2007-11-27  0:29     ` Stephane Hockenhull
  1 sibling, 0 replies; 34+ messages in thread
From: Joe Buck @ 2007-11-26 21:42 UTC (permalink / raw)
  To: Stephane Hockenhull, gcc

On Mon, Nov 26, 2007 at 02:01:30PM -0500, Daniel Jacobowitz wrote:
> On Mon, Nov 26, 2007 at 10:40:35AM -0800, Joe Buck wrote:
> > On Mon, Nov 26, 2007 at 01:33:54PM -0500, Stephane Hockenhull wrote:
> > > 
> > > hi, it seem stl templates are not mangled as other classes and templates
> > > 
> > > I was wondering why and where in the g++ source code is that special case 
> > > implemented?
> > > 
> > > it seem to cause a problem with -fleading-underscore
> > 
> > AFAIK there is no special case, however there might be a bug lurking
> > somewhere.  Do you have a specific case where -fleading-underscore messes
> > up?
> 
> There are a few special cases, e.g. for std::string and
> std::basic_string; the C++ ABI documents have the details.
> 
> _ZSi -> std::basic_istream<char, std::char_traits<char> >

Oh, right, I forgot about that one.

My guess is that no one thought about the interaction between this special
case and -fleading-underscore.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and   templates
  2007-11-26 19:55   ` Daniel Jacobowitz
  2007-11-26 21:42     ` Joe Buck
@ 2007-11-27  0:29     ` Stephane Hockenhull
  2007-11-27  6:25       ` Joe Buck
  1 sibling, 1 reply; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-27  0:29 UTC (permalink / raw)
  To: gcc; +Cc: Daniel Jacobowitz, Joe Buck

On Monday 26 November 2007 14:01, Daniel Jacobowitz wrote:
> On Mon, Nov 26, 2007 at 10:40:35AM -0800, Joe Buck wrote:
> > On Mon, Nov 26, 2007 at 01:33:54PM -0500, Stephane Hockenhull wrote:
> > > hi, it seem stl templates are not mangled as other classes and
> > > templates
> > >
> > > I was wondering why and where in the g++ source code is that special
> > > case implemented?
> > >
> > > it seem to cause a problem with -fleading-underscore
> >
> > AFAIK there is no special case, however there might be a bug lurking
> > somewhere.  Do you have a specific case where -fleading-underscore messes
> > up?
>
> There are a few special cases, e.g. for std::string and
> std::basic_string; the C++ ABI documents have the details.
>
> _ZSi -> std::basic_istream<char, std::char_traits<char> >

those cause problem with -fleading-underscore.

it seem there is more than one data path for the mangling and one of those 
misses adding the extra underscore which cause missing symbols at linking.

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and  templates
  2007-11-27  0:29     ` Stephane Hockenhull
@ 2007-11-27  6:25       ` Joe Buck
  2007-11-27 13:26         ` Daniel Jacobowitz
  2007-11-27 16:35         ` Stephane Hockenhull
  0 siblings, 2 replies; 34+ messages in thread
From: Joe Buck @ 2007-11-27  6:25 UTC (permalink / raw)
  To: Stephane Hockenhull; +Cc: gcc, Daniel Jacobowitz

On Mon, Nov 26, 2007 at 04:02:48PM -0500, Stephane Hockenhull wrote:
> On Monday 26 November 2007 14:01, Daniel Jacobowitz wrote:
> > On Mon, Nov 26, 2007 at 10:40:35AM -0800, Joe Buck wrote:
> > > On Mon, Nov 26, 2007 at 01:33:54PM -0500, Stephane Hockenhull wrote:
> > > > hi, it seem stl templates are not mangled as other classes and
> > > > templates
> > > >
> > > > I was wondering why and where in the g++ source code is that special
> > > > case implemented?
> > > >
> > > > it seem to cause a problem with -fleading-underscore
> > >
> > > AFAIK there is no special case, however there might be a bug lurking
> > > somewhere.  Do you have a specific case where -fleading-underscore messes
> > > up?
> >
> > There are a few special cases, e.g. for std::string and
> > std::basic_string; the C++ ABI documents have the details.
> >
> > _ZSi -> std::basic_istream<char, std::char_traits<char> >
> 
> those cause problem with -fleading-underscore.
> 
> it seem there is more than one data path for the mangling and one of those 
> misses adding the extra underscore which cause missing symbols at linking.

Hm.  But -fleading-underscore is there to support an old ABI, the one that
BSD Unix used to use, and the _ZSi is for the newer common ABI.  Probably
no one tested the interaction, so I don't know what the correct solution
is.

But why are you using -fleading-underscore?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and  templates
  2007-11-27  6:25       ` Joe Buck
@ 2007-11-27 13:26         ` Daniel Jacobowitz
  2007-11-27 16:51           ` Stephane Hockenhull
  2007-11-27 16:35         ` Stephane Hockenhull
  1 sibling, 1 reply; 34+ messages in thread
From: Daniel Jacobowitz @ 2007-11-27 13:26 UTC (permalink / raw)
  To: Joe Buck; +Cc: Stephane Hockenhull, gcc

On Mon, Nov 26, 2007 at 04:29:35PM -0800, Joe Buck wrote:
> But why are you using -fleading-underscore?

It's the default for a lot of targets.  I'd still like to see a
concrete example of the problem...

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and   templates
  2007-11-27  6:25       ` Joe Buck
  2007-11-27 13:26         ` Daniel Jacobowitz
@ 2007-11-27 16:35         ` Stephane Hockenhull
  2007-11-27 17:32           ` Dave Korn
  1 sibling, 1 reply; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-27 16:35 UTC (permalink / raw)
  To: gcc; +Cc: Joe Buck, Daniel Jacobowitz

On Monday 26 November 2007 19:29, Joe Buck wrote:
> On Mon, Nov 26, 2007 at 04:02:48PM -0500, Stephane Hockenhull wrote:
> > On Monday 26 November 2007 14:01, Daniel Jacobowitz wrote:
> > > On Mon, Nov 26, 2007 at 10:40:35AM -0800, Joe Buck wrote:
> > > > On Mon, Nov 26, 2007 at 01:33:54PM -0500, Stephane Hockenhull wrote:
> > > > > hi, it seem stl templates are not mangled as other classes and
> > > > > templates
> > > > >
> > > > > I was wondering why and where in the g++ source code is that
> > > > > special case implemented?
> > > > >
> > > > > it seem to cause a problem with -fleading-underscore
> > > >
> > > > AFAIK there is no special case, however there might be a bug lurking
> > > > somewhere.  Do you have a specific case where -fleading-underscore
> > > > messes up?
> > >
> > > There are a few special cases, e.g. for std::string and
> > > std::basic_string; the C++ ABI documents have the details.
> > >
> > > _ZSi -> std::basic_istream<char, std::char_traits<char> >
> >
> > those cause problem with -fleading-underscore.
> >
> > it seem there is more than one data path for the mangling and one of
> > those misses adding the extra underscore which cause missing symbols at
> > linking.
>
> Hm.  But -fleading-underscore is there to support an old ABI, the one that
> BSD Unix used to use, and the _ZSi is for the newer common ABI.  Probably
> no one tested the interaction, so I don't know what the correct solution
> is.
>
> But why are you using -fleading-underscore?

on the win32 platform all C symbols requires a leading underscore
everything works fine until we start using std::string objects, there is a bug 
with the special case name mangling.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34166

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and  templates
  2007-11-27 13:26         ` Daniel Jacobowitz
@ 2007-11-27 16:51           ` Stephane Hockenhull
  0 siblings, 0 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-27 16:51 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Joe Buck, gcc

On Monday 26 November 2007 22:48, Daniel Jacobowitz wrote:
> It's the default for a lot of targets.  I'd still like to see a
> concrete example of the problem...

we're cross-compiling to win32, everything works fine until we use the 
std::string template, 
the special case name mangling for std::string is partially broken by 
-fleading-underscore.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34166

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: why are stl template classes not mangled as other classes and   templates
  2007-11-27 16:35         ` Stephane Hockenhull
@ 2007-11-27 17:32           ` Dave Korn
  2007-11-27 18:11             ` Dave Korn
  0 siblings, 1 reply; 34+ messages in thread
From: Dave Korn @ 2007-11-27 17:32 UTC (permalink / raw)
  To: 'Stephane Hockenhull', gcc
  Cc: 'Joe Buck', 'Daniel Jacobowitz'

On 27 November 2007 15:49, Stephane Hockenhull wrote:

>> But why are you using -fleading-underscore?
> 
> on the win32 platform all C symbols requires a leading underscore

  Yes, that is the case on almost all platforms.

  And the compiler *automatically* puts leading underscores on symbols on all
those platforms already.

  So the question remains: why are you using -fleading-underscores?

  -fleading-underscore is intended for use on platforms that *don't* require a
leading underscore (e.g. ppc), where you might for special reasons want to
force the symbols to have an underscore anyway.

> everything works fine until we start using std::string objects, there is a
> bug with the special case name mangling.
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34166

  Yes, but as you yourself explain, the symbols already have leading
underscores, and when you use -fleading-underscore, because it fails to
consistently add *extra* underscores.

  So: why are you using -fleading-underscores?

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: why are stl template classes not mangled as other classes and   templates
  2007-11-27 17:32           ` Dave Korn
@ 2007-11-27 18:11             ` Dave Korn
  2007-11-27 18:39               ` Stephane Hockenhull
  0 siblings, 1 reply; 34+ messages in thread
From: Dave Korn @ 2007-11-27 18:11 UTC (permalink / raw)
  To: 'Dave Korn', 'Stephane Hockenhull', gcc
  Cc: 'Joe Buck', 'Daniel Jacobowitz'

On 27 November 2007 16:10, Dave Korn wrote:

>   Yes, but as you yourself explain, the symbols already have leading
> underscores, and when you use -fleading-underscore, because it fails to
                                                ^^^^^^^^^

... when you use -fleading-underscores, *a problem arises* because it fails to
...

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and   templates
  2007-11-27 18:11             ` Dave Korn
@ 2007-11-27 18:39               ` Stephane Hockenhull
  2007-11-27 19:58                 ` Dave Korn
  0 siblings, 1 reply; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-27 18:39 UTC (permalink / raw)
  To: gcc; +Cc: Dave Korn, 'Joe Buck', 'Daniel Jacobowitz'

On Tuesday 27 November 2007 11:09, you wrote:
> On 27 November 2007 15:49, Stephane Hockenhull wrote:
> >> But why are you using -fleading-underscore?
> >
> > on the win32 platform all C symbols requires a leading underscore
>
>   Yes, that is the case on almost all platforms.
>
>   And the compiler *automatically* puts leading underscores on symbols on
> all those platforms already.
>
>   So the question remains: why are you using -fleading-underscores?
>
>   -fleading-underscore is intended for use on platforms that *don't*
> require a leading underscore (e.g. ppc), where you might for special
> reasons want to force the symbols to have an underscore anyway.
>
> > everything works fine until we start using std::string objects, there is
> > a bug with the special case name mangling.
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34166
>
>   Yes, but as you yourself explain, the symbols already have leading
> underscores, and when you use -fleading-underscore, because it fails to
> consistently add *extra* underscores.

no, the symbol have a first underscore because that's how G++ mangles them, it 
ALWAYS add 1 underscore (without -fleading-underscore) and some other 
characters.

without -fleading-underscore for example "strstr" is called "strstr" but win32 
libraries need "_strstr" so -fleading-underscore must be used

with -fleading-underscore gcc/g++ adds an underscore to ALL symbols, including 
mangled ones, therefore it need TWO underscores for mangled names and ONE 
underscore for normal identifiers.

which g++ does right 99.9% of the time, but it only does it halfway to 
std::string.

it tries to call it as "__ZNSs7replaceEmmPKc"
but it instanciate it as "_ZNSs7replaceEmmPKc"

which is clearly a bug

I just need to know where in the code this boolean option is located and where 
the mangling is done so I can patch it up.

>   So: why are you using -fleading-underscores?
>
>     cheers,
>       DaveK


I'm an underscorophile, underscores makes me horny, that's why I drive around 
town in an blue-screen-painted icecream truck playing windows's boot up 
sounds to attract little windows symbols with underscores and "@" signs. 

joking aside, we need to generate ELF object files for running on windows.

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: why are stl template classes not mangled as other classes and  templates
  2007-11-27 18:39               ` Stephane Hockenhull
@ 2007-11-27 19:58                 ` Dave Korn
  2007-11-27 20:04                   ` 'Daniel Jacobowitz'
  0 siblings, 1 reply; 34+ messages in thread
From: Dave Korn @ 2007-11-27 19:58 UTC (permalink / raw)
  To: 'Stephane Hockenhull', gcc
  Cc: 'Joe Buck', 'Daniel Jacobowitz'

On 27 November 2007 17:35, Stephane Hockenhull wrote:
> On Tuesday 27 November 2007 11:09, you wrote:
>> On 27 November 2007 15:49, Stephane Hockenhull wrote:

>>> on the win32 platform all C symbols requires a leading underscore
>> 
>>   Yes, that is the case on almost all platforms.
>> 
>>   And the compiler *automatically* puts leading underscores on symbols on
>> all those platforms already. 
>> 
>>   So the question remains: why are you using -fleading-underscores?

>>> everything works fine until we start using std::string objects, there is
>>> a bug with the special case name mangling.
>>> 
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34166
>> 
>>   Yes, but as you yourself explain, the symbols already have leading
>> underscores, and when you use -fleading-underscore, because it fails to
>> consistently add *extra* underscores.
> 
> no, the symbol have a first underscore because that's how G++ mangles them,
> it ALWAYS add 1 underscore (without -fleading-underscore) and some other
> characters.
> 
> without -fleading-underscore for example "strstr" is called "strstr" but
> win32 libraries need "_strstr" so -fleading-underscore must be used

  You are simply wrong about this.  Let me demonstrate:

/tmp/lundersc $ cat test.cpp
extern "C" char *strstr (const char *, const char *);


void strtest (void)
{
  strstr ("foo", "foobar");
}

/tmp/lundersc $ g++ --save-temps -g -O0 -fno-builtin -c test.cpp -o test.o
/tmp/lundersc $ grep strstr test.s
        call    _strstr
        .def    _strstr;        .scl    3;      .type   32;     .endef
/tmp/lundersc $

  As you see, all the reference the compiler generates to strstr are already
prefixed by an underscore, with no need for any special flags.

> with -fleading-underscore gcc/g++ adds an underscore to ALL symbols,
> including mangled ones, therefore it need TWO underscores for mangled names
> and ONE underscore for normal identifiers.

  Given that you have misunderstood the starting point, your conclusion here
is wrong.  *All* names, whether mangled or non-mangled, are given an
underscore by the compiler.  This underscore is concealed at the C and C++
level and is visible and relevant only in the assembler level.

> which g++ does right 99.9% of the time, but it only does it halfway to
> std::string.
> 
> it tries to call it as "__ZNSs7replaceEmmPKc"
> but it instanciate it as "_ZNSs7replaceEmmPKc"
> 
> which is clearly a bug

  Yes, that bit is, but then again, you should not be using
-fleading-underscore in the first place, and if you think you do need to do
so, there is something more fundamental wrong in your setup.  Are you sure
you're even using a win32 version of the compiler?

> I just need to know where in the code this boolean option is located and
> where the mangling is done so I can patch it up.

  No, you do not.  You have misdiagnosed the problem and obtained an incorrect
solution.  Have you read the manual?  When it explains -fleading-underscores,
it explicitly states:

" Not all targets provide complete support for this switch. "

  The x86 is one of those targets.  It does not provide complete support for
this switch, but then again, there is not and has never been any need for this
switch on the x86.

> joking aside, we need to generate ELF object files for running on windows.

  OK, you are now attempting something very very wrong indeed.  The win32
version of the assembler will not generate ELF files, and even if it did,
windows cannot make any use of the ELF format, it uses PE-COFF.  And the
output file format has absolutely nothing to do with whether or not the
symbols have leading underscores, so claiming that you have to use
-fleading-underscores because you need to generate ELF files is a
non-sequitur.

  So:  You do not need to use -fleading-underscores, if you think you do then
/something else/ is going wrong already, and you are just making it worse for
yourself because -fleading-underscores is not supported on x86/win32 and the
use of it is giving you *additional problems* on top of the problem you
already have, and you have a mistaken notion that any of this has anything to
do with ELF or non-ELF.

  What is the *real* problem?  What is it that convinced you that you needed
to use -fleading-underscores in the first place?  Because whatever it was, it
has a different and better solution - one that works, not one that breaks even
worse.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes and  templates
  2007-11-27 19:58                 ` Dave Korn
@ 2007-11-27 20:04                   ` 'Daniel Jacobowitz'
  2007-11-27 20:19                     ` why are stl template classes not mangled as other classes andtemplates Dave Korn
  0 siblings, 1 reply; 34+ messages in thread
From: 'Daniel Jacobowitz' @ 2007-11-27 20:04 UTC (permalink / raw)
  To: Dave Korn; +Cc: 'Stephane Hockenhull', gcc, 'Joe Buck'

On Tue, Nov 27, 2007 at 06:39:09PM -0000, Dave Korn wrote:
> > joking aside, we need to generate ELF object files for running on windows.
> 
>   OK, you are now attempting something very very wrong indeed.  The win32
> version of the assembler will not generate ELF files, and even if it did,
> windows cannot make any use of the ELF format, it uses PE-COFF.  And the
> output file format has absolutely nothing to do with whether or not the
> symbols have leading underscores, so claiming that you have to use
> -fleading-underscores because you need to generate ELF files is a
> non-sequitur.

Please give them a little credit.  I would assume they're using an
i386-elf compiler and have some mechanism of their own to make the ELF
files run.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: why are stl template classes not mangled as other classes andtemplates
  2007-11-27 20:04                   ` 'Daniel Jacobowitz'
@ 2007-11-27 20:19                     ` Dave Korn
  2007-11-27 21:32                       ` Stephane Hockenhull
  0 siblings, 1 reply; 34+ messages in thread
From: Dave Korn @ 2007-11-27 20:19 UTC (permalink / raw)
  To: 'Daniel Jacobowitz'
  Cc: 'Stephane Hockenhull', gcc, 'Joe Buck'

On 27 November 2007 18:47, 'Daniel Jacobowitz' wrote:

> On Tue, Nov 27, 2007 at 06:39:09PM -0000, Dave Korn wrote:
>>> joking aside, we need to generate ELF object files for running on windows.
>> 
>>   OK, you are now attempting something very very wrong indeed.  The win32
>> version of the assembler will not generate ELF files, and even if it did,
>> windows cannot make any use of the ELF format, it uses PE-COFF.  And the
>> output file format has absolutely nothing to do with whether or not the
>> symbols have leading underscores, so claiming that you have to use
>> -fleading-underscores because you need to generate ELF files is a
>> non-sequitur.
> 
> Please give them a little credit.  I would assume they're using an
> i386-elf compiler and have some mechanism of their own to make the ELF
> files run.

  I am making no assumptions either way; I'd like some clarification.

  Wouldn't a simpler and more-likely-to-be-reliable technique be to use a
win32 /compiler/ (so as to get all the ABI issues right, not just the amount
of underscores on symbols) and only generate/convert to ELF further down the
toolchain?

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-27 20:19                     ` why are stl template classes not mangled as other classes andtemplates Dave Korn
@ 2007-11-27 21:32                       ` Stephane Hockenhull
  2007-11-27 21:44                         ` Andrew Pinski
                                           ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-27 21:32 UTC (permalink / raw)
  To: gcc; +Cc: Dave Korn, 'Daniel Jacobowitz', 'Joe Buck'

On Tuesday 27 November 2007 14:00, Dave Korn wrote:
> On 27 November 2007 18:47, 'Daniel Jacobowitz' wrote:
> > On Tue, Nov 27, 2007 at 06:39:09PM -0000, Dave Korn wrote:
> >>> joking aside, we need to generate ELF object files for running on
> >>> windows.
> >>
> >>   OK, you are now attempting something very very wrong indeed.  The
> >> win32 version of the assembler will not generate ELF files, and even if
> >> it did, windows cannot make any use of the ELF format, it uses PE-COFF. 
> >> And the output file format has absolutely nothing to do with whether or
> >> not the symbols have leading underscores, so claiming that you have to
> >> use -fleading-underscores because you need to generate ELF files is a
> >> non-sequitur.
> >
> > Please give them a little credit.  I would assume they're using an
> > i386-elf compiler and have some mechanism of their own to make the ELF
> > files run.
>
>   I am making no assumptions either way; I'd like some clarification.
>
>   Wouldn't a simpler and more-likely-to-be-reliable technique be to use a
> win32 /compiler/ (so as to get all the ABI issues right, not just the
> amount of underscores on symbols) and only generate/convert to ELF further
> down the toolchain?

no, it would not.
because for one simple fact: COFF format lacks many features of ELF.

this is why we're compiling, assembling, linking, patching, and dynamically 
re-linking everything in ELF format, including using a custom linker script 
that generates an ELF file that is win32 "compatible" (load addresses and 
all)

we then convert the final executable to PE format and run it on the target 
platform.

this even allows us to debug the win32 application from linux using the ELF 
version of the executable file and system's default GDB, or Kdbg, or DDD, or 
what not, with a gdb stub so even if we're running fullscreen under windows 
we can still debug even tho the win32 GUI is frozen and a normal win32 
debugger would just deadlock the system.

this turns debugging under win32 into something akin to working on an embedded 
platform, we also have the same source code running natively on GameCube 
(PPC32-BE), Nintendo DS (ARM-LE), and Linux AMD64 among others.

please dont worry for us about ABI issues and what not, I've got that part 
working, thank you.

now, if only someone actually knew where in the g++ source code the special 
case for std::string is I could fix that, provide a patch, and make the world 
a little bit better.

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes andtemplates
  2007-11-27 21:32                       ` Stephane Hockenhull
@ 2007-11-27 21:44                         ` Andrew Pinski
  2007-11-27 22:30                           ` Stephane Hockenhull
  2007-11-27 22:14                         ` Andreas Schwab
  2007-11-27 22:23                         ` Andreas Schwab
  2 siblings, 1 reply; 34+ messages in thread
From: Andrew Pinski @ 2007-11-27 21:44 UTC (permalink / raw)
  To: Stephane Hockenhull; +Cc: gcc, Dave Korn, Daniel Jacobowitz, Joe Buck

On 11/27/07, Stephane Hockenhull <shockenhull@niceberg.com> wrote:
> no, it would not.
> because for one simple fact: COFF format lacks many features of ELF.

What features are missing?  COFF is not used for Windows 32 anyways,
it is PE-COFF.  I am just wondering what exactly is missing that you
think you need to go this route.

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-27 21:32                       ` Stephane Hockenhull
  2007-11-27 21:44                         ` Andrew Pinski
@ 2007-11-27 22:14                         ` Andreas Schwab
  2007-11-27 22:34                           ` Stephane Hockenhull
  2007-11-28 20:36                           ` Stephane Hockenhull
  2007-11-27 22:23                         ` Andreas Schwab
  2 siblings, 2 replies; 34+ messages in thread
From: Andreas Schwab @ 2007-11-27 22:14 UTC (permalink / raw)
  To: Stephane Hockenhull
  Cc: gcc, Dave Korn, 'Daniel Jacobowitz', 'Joe Buck'

Stephane Hockenhull <shockenhull@niceberg.com> writes:

> now, if only someone actually knew where in the g++ source code the special 
> case for std::string is

grep is your friend.  Look for find_substitution in cp/mangle.c.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-27 21:32                       ` Stephane Hockenhull
  2007-11-27 21:44                         ` Andrew Pinski
  2007-11-27 22:14                         ` Andreas Schwab
@ 2007-11-27 22:23                         ` Andreas Schwab
  2 siblings, 0 replies; 34+ messages in thread
From: Andreas Schwab @ 2007-11-27 22:23 UTC (permalink / raw)
  To: Stephane Hockenhull
  Cc: gcc, Dave Korn, 'Daniel Jacobowitz', 'Joe Buck'

Stephane Hockenhull <shockenhull@niceberg.com> writes:

> now, if only someone actually knew where in the g++ source code the special 
> case for std::string is I could fix that, provide a patch, and make the world 
> a little bit better.

Actually I think you rather want to look for places that use
USER_LABEL_PREFIX directly instead of user_label_prefix.  There is only
one occurrence under config/i386, but I don't know how relevant it is.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-27 21:44                         ` Andrew Pinski
@ 2007-11-27 22:30                           ` Stephane Hockenhull
  0 siblings, 0 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-27 22:30 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc, Dave Korn, Daniel Jacobowitz, Joe Buck

On Tuesday 27 November 2007 15:40, Andrew Pinski wrote:
> On 11/27/07, Stephane Hockenhull <shockenhull@niceberg.com> wrote:
> > no, it would not.
> > because for one simple fact: COFF format lacks many features of ELF.
>
> What features are missing?  COFF is not used for Windows 32 anyways,
> it is PE-COFF.  I am just wondering what exactly is missing that you
> think you need to go this route.
>
> Thanks,
> Andrew Pinski

we had some problem with some missing flags, like weak and others special 
attributes we use in some parts to provide extended features.

but anyway, we have some special processing done where we need to be able to 
read the object files and we also use a custom dynamic linker so everything 
has to be in ELF format.

BFD is really nice, but a bit too big to run on one of our platforms (3MB RAM 
embedded system) so we had to develop custom routines anyway and elf is easy 
enough to parse, so for KISS reasons those routines ends up on all platforms.

I can't say much more.

all I can say is going the all-ELF way right to the end really works nicely, 
*EXCEPT* for that std::string issue.

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-27 22:14                         ` Andreas Schwab
@ 2007-11-27 22:34                           ` Stephane Hockenhull
  2007-11-28 20:36                           ` Stephane Hockenhull
  1 sibling, 0 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-27 22:34 UTC (permalink / raw)
  To: gcc

On Tuesday 27 November 2007 15:50, Andreas Schwab wrote:
> Stephane Hockenhull <shockenhull@niceberg.com> writes:
> > now, if only someone actually knew where in the g++ source code the
> > special case for std::string is
>
> grep is your friend.  Look for find_substitution in cp/mangle.c.
>
> Andreas.

*THANK YOU*

... checking now

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-27 22:14                         ` Andreas Schwab
  2007-11-27 22:34                           ` Stephane Hockenhull
@ 2007-11-28 20:36                           ` Stephane Hockenhull
  2007-11-28 20:44                             ` Dave Korn
  1 sibling, 1 reply; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-28 20:36 UTC (permalink / raw)
  To: gcc
  Cc: Andreas Schwab, Dave Korn, 'Daniel Jacobowitz',
	'Joe Buck'

On Tuesday 27 November 2007 15:50, Andreas Schwab wrote:
> Stephane Hockenhull <shockenhull@niceberg.com> writes:
> > now, if only someone actually knew where in the g++ source code the
> > special case for std::string is
>
> grep is your friend.  Look for find_substitution in cp/mangle.c.
>
> Andreas.

something just occured to me ... the std::string template is not compiled into 
the .s file

are those templates pre-compiled into some "magical" hidden library?
I could not find them in my gcc installations both native and i386-unknown-elf

grep 'ZNSs7replaceEmmRKSs' * -R

didnt find anything (compressed?).

where is that template instanciated ?

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: why are stl template classes not mangled as other classes andtemplates
  2007-11-28 20:36                           ` Stephane Hockenhull
@ 2007-11-28 20:44                             ` Dave Korn
  2007-11-28 20:45                               ` Stephane Hockenhull
  0 siblings, 1 reply; 34+ messages in thread
From: Dave Korn @ 2007-11-28 20:44 UTC (permalink / raw)
  To: 'Stephane Hockenhull', gcc
  Cc: 'Andreas Schwab', 'Daniel Jacobowitz',
	'Joe Buck'

On 28 November 2007 17:33, Stephane Hockenhull wrote:

> something just occured to me ... the std::string template is not compiled
> into the .s file
> 
> are those templates pre-compiled into some "magical" hidden library?
> I could not find them in my gcc installations both native and
> i386-unknown-elf 
> 
> grep 'ZNSs7replaceEmmRKSs' * -R
> 
> didnt find anything (compressed?).
> 
> where is that template instanciated ?

  The instantiations end up in the .o files of your project when you compile,
not in the compiler or its support libraries.  Does this page:

http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html#Template-Instant
iation

answer the question for you?


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-28 20:44                             ` Dave Korn
@ 2007-11-28 20:45                               ` Stephane Hockenhull
  2007-11-28 20:58                                 ` 'Daniel Jacobowitz'
  2007-11-28 21:00                                 ` Dave Korn
  0 siblings, 2 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-28 20:45 UTC (permalink / raw)
  To: Dave Korn
  Cc: gcc, 'Andreas Schwab', 'Daniel Jacobowitz',
	'Joe Buck'

On Wednesday 28 November 2007 12:35, Dave Korn wrote:
> On 28 November 2007 17:33, Stephane Hockenhull wrote:
> > something just occured to me ... the std::string template is not compiled
> > into the .s file
> >
> > are those templates pre-compiled into some "magical" hidden library?
> > I could not find them in my gcc installations both native and
> > i386-unknown-elf
> >
> > grep 'ZNSs7replaceEmmRKSs' * -R
> >
> > didnt find anything (compressed?).
> >
> > where is that template instanciated ?
>
>   The instantiations end up in the .o files of your project when you
> compile, not in the compiler or its support libraries.  Does this page:
>
> http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html#Template-Inst
>ant iation
>
> answer the question for you?
>
>
>     cheers,
>       DaveK

no, it does not.
I know templates *NORMALLY* end up in the .s file after the compilation pass 
then the .o file after the assembly pass.

if you actually read my email I said :
> > the std::string template is ----> ****NOT**** <---- compiled into the .s 
file

g++ does not seem to put the std::string template's code into the .o file like 
the other templates.

it seem to NOT be instanciated in the .o file.

I guess it would make sense to have the std::string class compiled once 
instead of in every file since its used everywhere, that would greatly speed 
up compile time but would cause problem in my case.

I have the .s file right here and there is no assembly code for the 
std::string template's instance at all. my other templates are there, just 
not std::string.

hence my question: where is it?

and, if it IS precompiled, can I force g++ to compile td::string every time to 
see if that fixes the problem?

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-28 20:45                               ` Stephane Hockenhull
@ 2007-11-28 20:58                                 ` 'Daniel Jacobowitz'
  2007-11-28 21:25                                   ` Stephane Hockenhull
  2007-11-28 22:24                                   ` Stephane Hockenhull
  2007-11-28 21:00                                 ` Dave Korn
  1 sibling, 2 replies; 34+ messages in thread
From: 'Daniel Jacobowitz' @ 2007-11-28 20:58 UTC (permalink / raw)
  To: Stephane Hockenhull
  Cc: Dave Korn, gcc, 'Andreas Schwab', 'Joe Buck'

On Wed, Nov 28, 2007 at 01:56:58PM -0500, Stephane Hockenhull wrote:
> hence my question: where is it?

In libstdc++.  You have to link with libstdc++ to use the STL, for
many reasons including this one.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: why are stl template classes not mangled as other classes andtemplates
  2007-11-28 20:45                               ` Stephane Hockenhull
  2007-11-28 20:58                                 ` 'Daniel Jacobowitz'
@ 2007-11-28 21:00                                 ` Dave Korn
  1 sibling, 0 replies; 34+ messages in thread
From: Dave Korn @ 2007-11-28 21:00 UTC (permalink / raw)
  To: 'Stephane Hockenhull'
  Cc: gcc, 'Andreas Schwab', 'Daniel Jacobowitz',
	'Joe Buck'

On 28 November 2007 18:57, Stephane Hockenhull wrote:

> if you actually read my email 

  Of course I read your email.

> I said :
>>> the std::string template is ----> ****NOT**** <---- compiled into the .s
>>> file 

  Well, yes, but you also said they weren't anywhere else either.

  So it wasn't entirely unreasonable of me to assume that one of those two
statements was incorrect and they both needed verifying.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes   andtemplates
  2007-11-28 20:58                                 ` 'Daniel Jacobowitz'
@ 2007-11-28 21:25                                   ` Stephane Hockenhull
  2007-11-28 22:03                                     ` why are stl template classes not mangled as other classes ?andtemplates 'Daniel Jacobowitz'
                                                       ` (2 more replies)
  2007-11-28 22:24                                   ` Stephane Hockenhull
  1 sibling, 3 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-28 21:25 UTC (permalink / raw)
  To: gcc
  Cc: 'Daniel Jacobowitz', Dave Korn, 'Andreas Schwab',
	'Joe Buck'

On Wednesday 28 November 2007 14:01, 'Daniel Jacobowitz' wrote:
> On Wed, Nov 28, 2007 at 01:56:58PM -0500, Stephane Hockenhull wrote:
> > hence my question: where is it?
>
> In libstdc++.  You have to link with libstdc++ to use the STL, for
> many reasons including this one.

is there a way to disable this behaviour for stl templates and have them 
compiled every time?

I can't find a command line option for it.

this breaks C++ code using the STL when -fleading-underscore is used, other 
templates compile and link just fine.

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  ?andtemplates
  2007-11-28 21:25                                   ` Stephane Hockenhull
@ 2007-11-28 22:03                                     ` 'Daniel Jacobowitz'
  2007-11-28 23:17                                     ` why are stl template classes not mangled as other classes andtemplates Andrew Pinski
  2007-11-28 23:25                                     ` Jonathan Wakely
  2 siblings, 0 replies; 34+ messages in thread
From: 'Daniel Jacobowitz' @ 2007-11-28 22:03 UTC (permalink / raw)
  To: Stephane Hockenhull
  Cc: gcc, Dave Korn, 'Andreas Schwab', 'Joe Buck'

On Wed, Nov 28, 2007 at 03:38:50PM -0500, Stephane Hockenhull wrote:
> On Wednesday 28 November 2007 14:01, 'Daniel Jacobowitz' wrote:
> > On Wed, Nov 28, 2007 at 01:56:58PM -0500, Stephane Hockenhull wrote:
> > > hence my question: where is it?
> >
> > In libstdc++.  You have to link with libstdc++ to use the STL, for
> > many reasons including this one.
> 
> is there a way to disable this behaviour for stl templates and have them 
> compiled every time?

No.  You must link to libstdc++.  More than this will break at runtime
if you do not, e.g. streams.

> this breaks C++ code using the STL when -fleading-underscore is used, other 
> templates compile and link just fine.

This does not make sense.  Compile libstdc++ with -fleading-underscore
if that's the problem.  You need to get libgcc too.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes   andtemplates
  2007-11-28 20:58                                 ` 'Daniel Jacobowitz'
  2007-11-28 21:25                                   ` Stephane Hockenhull
@ 2007-11-28 22:24                                   ` Stephane Hockenhull
  1 sibling, 0 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-28 22:24 UTC (permalink / raw)
  To: Dave Korn, gcc, 'Andreas Schwab', 'Joe Buck'

On Wednesday 28 November 2007 14:01, 'Daniel Jacobowitz' wrote:
> On Wed, Nov 28, 2007 at 01:56:58PM -0500, Stephane Hockenhull wrote:
> > hence my question: where is it?
>
> In libstdc++.  You have to link with libstdc++ to use the STL, for
> many reasons including this one.

ar x ../libstdc++.a
grep 'ZNSs7replaceEmmPKc' *.o

does not find any matches.

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes andtemplates
  2007-11-28 21:25                                   ` Stephane Hockenhull
  2007-11-28 22:03                                     ` why are stl template classes not mangled as other classes ?andtemplates 'Daniel Jacobowitz'
@ 2007-11-28 23:17                                     ` Andrew Pinski
  2007-11-29  0:08                                       ` Stephane Hockenhull
  2007-11-28 23:25                                     ` Jonathan Wakely
  2 siblings, 1 reply; 34+ messages in thread
From: Andrew Pinski @ 2007-11-28 23:17 UTC (permalink / raw)
  To: Stephane Hockenhull
  Cc: gcc, Daniel Jacobowitz, Dave Korn, Andreas Schwab, Joe Buck

On 11/28/07, Stephane Hockenhull <shockenhull@niceberg.com> wrote:
> is there a way to disable this behaviour for stl templates and have them
> compiled every time?
>
> I can't find a command line option for it.

It is a source level option.  Remove all the use of "extern template"
in the headers of libstdc++.

-- Pinski

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes andtemplates
  2007-11-28 21:25                                   ` Stephane Hockenhull
  2007-11-28 22:03                                     ` why are stl template classes not mangled as other classes ?andtemplates 'Daniel Jacobowitz'
  2007-11-28 23:17                                     ` why are stl template classes not mangled as other classes andtemplates Andrew Pinski
@ 2007-11-28 23:25                                     ` Jonathan Wakely
  2007-11-29  0:11                                       ` Stephane Hockenhull
  2 siblings, 1 reply; 34+ messages in thread
From: Jonathan Wakely @ 2007-11-28 23:25 UTC (permalink / raw)
  To: Stephane Hockenhull; +Cc: gcc

On 28/11/2007, Stephane Hockenhull <shockenhull@niceberg.com> wrote:
> On Wednesday 28 November 2007 14:01, 'Daniel Jacobowitz' wrote:
> > On Wed, Nov 28, 2007 at 01:56:58PM -0500, Stephane Hockenhull wrote:
> > > hence my question: where is it?
> >
> > In libstdc++.  You have to link with libstdc++ to use the STL, for
> > many reasons including this one.
>
> is there a way to disable this behaviour for stl templates and have them
> compiled every time?
>
> I can't find a command line option for it.
>
> this breaks C++ code using the STL when -fleading-underscore is used, other
> templates compile and link just fine.

IIRC, -D_GLIBCXX_EXTERN_TEMPLATE=0 might work, but it's neither
documented nor supported.

Jon

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-28 23:17                                     ` why are stl template classes not mangled as other classes andtemplates Andrew Pinski
@ 2007-11-29  0:08                                       ` Stephane Hockenhull
  0 siblings, 0 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-29  0:08 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc, Daniel Jacobowitz, Dave Korn, Andreas Schwab, Joe Buck

On Wednesday 28 November 2007 16:25, Andrew Pinski wrote:
> On 11/28/07, Stephane Hockenhull <shockenhull@niceberg.com> wrote:
> > is there a way to disable this behaviour for stl templates and have them
> > compiled every time?
> >
> > I can't find a command line option for it.
>
> It is a source level option.  Remove all the use of "extern template"
> in the headers of libstdc++.
>
> -- Pinski

YES! works! thank you very much!

there is a define to disable them in bunch:  _GLIBCXX_EXTERN_TEMPLATE

g++ -c -save-temps -fleading-underscore -D_GLIBCXX_EXTERN_TEMPLATE=0 test.cpp 
-o test.o

templates get compiled in just fine, with correct underscore, no need to 
recompile libstdc++

*drops on the floor side-walking in circle whooping a la Homer S.*

I added a comment to bug for the work around
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34166

but left it unconfirmed, should it be closed, just documented, or the feature 
automatically disabled if someone overrides the platform's default prefix 
rule ??

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: why are stl template classes not mangled as other classes  andtemplates
  2007-11-28 23:25                                     ` Jonathan Wakely
@ 2007-11-29  0:11                                       ` Stephane Hockenhull
  0 siblings, 0 replies; 34+ messages in thread
From: Stephane Hockenhull @ 2007-11-29  0:11 UTC (permalink / raw)
  To: gcc; +Cc: Jonathan Wakely

On Wednesday 28 November 2007 17:24, Jonathan Wakely wrote:
> On 28/11/2007, Stephane Hockenhull <shockenhull@niceberg.com> wrote:
> > On Wednesday 28 November 2007 14:01, 'Daniel Jacobowitz' wrote:
> > > On Wed, Nov 28, 2007 at 01:56:58PM -0500, Stephane Hockenhull wrote:
> > > > hence my question: where is it?
> > >
> > > In libstdc++.  You have to link with libstdc++ to use the STL, for
> > > many reasons including this one.
> >
> > is there a way to disable this behaviour for stl templates and have them
> > compiled every time?
> >
> > I can't find a command line option for it.
> >
> > this breaks C++ code using the STL when -fleading-underscore is used,
> > other templates compile and link just fine.
>
> IIRC, -D_GLIBCXX_EXTERN_TEMPLATE=0 might work, but it's neither
> documented nor supported.
>
> Jon

thanks, found it grepping for "extern template"

it does work, worst case if it breaks again we'll stick with the gcc version 
we're currently using until we find some work around :P

-- 
Stephane Hockenhull
SSC-Studios.com

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2007-11-28 22:37 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-26 19:00 why are stl template classes not mangled as other classes and templates Stephane Hockenhull
2007-11-26 19:08 ` Joe Buck
2007-11-26 19:52   ` Stephane Hockenhull
2007-11-26 19:55   ` Daniel Jacobowitz
2007-11-26 21:42     ` Joe Buck
2007-11-27  0:29     ` Stephane Hockenhull
2007-11-27  6:25       ` Joe Buck
2007-11-27 13:26         ` Daniel Jacobowitz
2007-11-27 16:51           ` Stephane Hockenhull
2007-11-27 16:35         ` Stephane Hockenhull
2007-11-27 17:32           ` Dave Korn
2007-11-27 18:11             ` Dave Korn
2007-11-27 18:39               ` Stephane Hockenhull
2007-11-27 19:58                 ` Dave Korn
2007-11-27 20:04                   ` 'Daniel Jacobowitz'
2007-11-27 20:19                     ` why are stl template classes not mangled as other classes andtemplates Dave Korn
2007-11-27 21:32                       ` Stephane Hockenhull
2007-11-27 21:44                         ` Andrew Pinski
2007-11-27 22:30                           ` Stephane Hockenhull
2007-11-27 22:14                         ` Andreas Schwab
2007-11-27 22:34                           ` Stephane Hockenhull
2007-11-28 20:36                           ` Stephane Hockenhull
2007-11-28 20:44                             ` Dave Korn
2007-11-28 20:45                               ` Stephane Hockenhull
2007-11-28 20:58                                 ` 'Daniel Jacobowitz'
2007-11-28 21:25                                   ` Stephane Hockenhull
2007-11-28 22:03                                     ` why are stl template classes not mangled as other classes ?andtemplates 'Daniel Jacobowitz'
2007-11-28 23:17                                     ` why are stl template classes not mangled as other classes andtemplates Andrew Pinski
2007-11-29  0:08                                       ` Stephane Hockenhull
2007-11-28 23:25                                     ` Jonathan Wakely
2007-11-29  0:11                                       ` Stephane Hockenhull
2007-11-28 22:24                                   ` Stephane Hockenhull
2007-11-28 21:00                                 ` Dave Korn
2007-11-27 22:23                         ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).