This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ name mangling, old and new versions?
- To: "T. Huld" <thomas dot huld at jrc dot it>
- Subject: Re: C++ name mangling, old and new versions?
- From: Andi Kleen <ak at muc dot de>
- Date: 05 Mar 1998 04:28:46 +0100
- Cc: egcs at cygnus dot com
- References: <9803041404.AA24037@elena.sti.jrc.it>
"T. Huld" <thomas.huld@jrc.it> writes:
> Hello,
>
> It's probably just me doing something stupid, but here goes:
>
> My setup:
> Intel 586, Linux Red Hat 5.0, glibc-2.0.6, egcs-1.0.1
> all binary distributions.
>
>
> According to the info, egcs performs a name mangling which is not
> compatible with the one done by gcc-2.7. I have verified this by trying
> to link egcs-compiled programs with a binary distribution of the
> QT library. With the binary distribution library the linking fails, if I
> recompile the library with egcs the linking works OK.
>
> HOWEVER, there is supposed to be an option: -fname-mangling-version-N,
> where you can choose between the old name mangling convention (N=0)
> and the new one (N=1). But when I try to compile with the two different
> options, I get identical object files, and 'nm' reports no difference
> whatsoever.
>
> The call to g++ looks like this:
>
> g++ -c -fname-mangling-version-0 -g2 -Wall -DLINUX
> -I/usr/home2/thomas/newreac/includes -I/usr/local/qt/include
> /usr/home2/thomas/newreac/sources/gui/gwndmain.cpp -o
> /usr/home2/thomas/newreac/sources/gui/gwndmain.o
I had good look with -fno-rtti -fno-exceptions together with a 2.7.2
compiled Qt. The vtable layout is different when RTTI is enabled, so
egcs protects against mistakes by encoding that in the mangled name.
You have to explicitely turn it off, -fname-mangling-version-0 is not
enough.
-Andi