Bug#116823: Debian's g++-3.0 forgets to generate some code.
Package: g++-3.0
Version: 1:3.0.2-0pre011014
Severity: important
Summary: It seems like some bug crept into Debian's gcc-3.0. The bug does
not seem to be present upstream. This bug renders the CLN package
unlinkable with our compiler.
The following piece of code is extracted from CLN's PROVIDE/REQUIRE
mechanism for setting up global objects:
------------------------------------------------------------------------------------
extern "C" void module__prin_globals__firstglobalfun () {}
extern "C" void module__prin_globals__ctorend (void);
extern "C" void module__prin_globals__dtorend (void);
__asm__("\t.globl _GLOBAL__I_module__prin_globals__firstglobalfun");
__asm__("\t.globl _GLOBAL__D_module__prin_globals__firstglobalfun");
static int module__prin_globals__counter;
struct module__prin_globals__controller {
inline module__prin_globals__controller ()
{
if (module__prin_globals__counter++) {
__asm__ ("jmp %*%0" : : "rm" ((void*)( module__prin_globals__ctorend ))) ;
}
}
inline ~module__prin_globals__controller ()
{
__asm__ ("\n" "" "module__" "prin_globals" "__dtorend" ":") ;
}
};
static module__prin_globals__controller module__prin_globals__ctordummy;
------------------------------------------------------------------------------------
When compiled with `g++-3.0 -O -c' the resulting .o file starts with
U _GLOBAL__D_module__prin_globals__firstglobalfun
00000058 T _GLOBAL__I_module__prin_globals__firstglobalfun
Rather, there should be a text section for `_GLOBAL__D_module_...' as
well, in the following fashion:
00000070 T _GLOBAL__D_module__prin_globals__firstglobalfun
00000050 T _GLOBAL__I_module__prin_globals__firstglobalfun
I am able to generate the above (correct) symbols with either RedHat's
`g++3' or with the snapshot `gcc-3.0.2-20011014' bootstrapped on a Woody
system with no configure-options other than --prefix. The erroneously
missing symbols can also be reproducsed with Debian's version
1:3.0.2-0pre010922. Also, analyzing the output directly with `cc1plus',
one finds that we cannot blame binutils. The code is simply not generated
with Debian's compiler:
$ /usr/lib/gcc-lib/i386-linux/3.0.2/cc1plus -quiet -dumpbase foo.cpp -O -version -o foo.s foo.cpp
GNU CPP version 3.0.2 20011014 (Debian prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.2 20011014 (Debian prerelease) (i386-linux)
compiled by GNU C version 3.0.2 20011014 (Debian prerelease).
$ grep _D_ foo.s # WRONG
.globl _GLOBAL__D_module__prin_globals__firstglobalfun
$ grep _I_ foo.s # okay
.globl _GLOBAL__I_module__prin_globals__firstglobalfun
.type _GLOBAL__I_module__prin_globals__firstglobalfun,@function
_GLOBAL__I_module__prin_globals__firstglobalfun:
.size _GLOBAL__I_module__prin_globals__firstglobalfun,.Lfe4-_GLOBAL__I_module__prin_globals__firstglobalfun
.long _GLOBAL__I_module__prin_globals__firstglobalfun
Whereas it is generated fine with the hand-bootstrapped compiler:
$ /home/kreckel/projects/gcc-3.0.2-20011014/lib/gcc-lib/i686-pc-linux-gnu/3.0.2/cc1plus -quiet -dumpbase foo.cpp -O -version -o foo.s foo.cpp
GNU CPP version 3.0.2 20011014 (prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.2 20011014 (prerelease) (i686-pc-linux-gnu)
compiled by GNU C version 3.0.2 20011014 (prerelease).
$ grep _D_ foo.s # okay
.globl _GLOBAL__D_module__prin_globals__firstglobalfun
.type _GLOBAL__D_module__prin_globals__firstglobalfun,@function
_GLOBAL__D_module__prin_globals__firstglobalfun:
.size _GLOBAL__D_module__prin_globals__firstglobalfun,.Lfe4-_GLOBAL__D_module__prin_globals__firstglobalfun
.long _GLOBAL__D_module__prin_globals__firstglobalfun
$ grep _I_ foo.s #okay
.globl _GLOBAL__I_module__prin_globals__firstglobalfun
.type _GLOBAL__I_module__prin_globals__firstglobalfun,@function
_GLOBAL__I_module__prin_globals__firstglobalfun:
.size _GLOBAL__I_module__prin_globals__firstglobalfun,.Lfe3-_GLOBAL__I_module__prin_globals__firstglobalfun
.long _GLOBAL__I_module__prin_globals__firstglobalfun
All this suggests that some bad patch went into Debian's gcc-3.0 or that
some configure options break the compiler. What is it?!?
Regards
-richy.
--
.''`. Richard B. Kreckel
: :' : <kreckel@debian.org>
`. `' <kreckel@ginac.de>
`- <http://www.ginac.de/~kreckel/>
Reply to: