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

Reply via email to