This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -frepo problems


This is quite enough for a diagnostic... It will probably get a while
until I fix it, as the precise details of name-mangling are not very
thoroughly documented, so I will have to go hunting to find what's going
on... pointers on where I should start looking are VERY welcome.

With the `newer' OpenBSD egcs configuration, that uses VTABLE_THUNKS,
name-mangling is already different...  it is definitely an internal bug 
of egcs, as c++filt should be able to reverse the mangling and give proper 
names...

Here is what I'm getting:

tetto-~/Projects/egcs% eg++ -v -frepo dumbrepo.o
Reading specs from
/usr/local/lib/gcc-lib/i386-unknown-openbsd2.4/egcs-2.92.34/specs
gcc version egcs-2.92.34 19990103 (gcc2 ss-980609 experimental)
 /usr/local/lib/gcc-lib/i386-unknown-openbsd2.4/egcs-2.92.34/collect2 -e start
 -dc -dp /usr/lib/crt0.o
 -L/usr/local/lib/gcc-lib/i386-unknown-openbsd2.4/egcs-2.92.34
 -L/usr/local/i386-unknown-openbsd2.4/lib -L/usr/local/lib dumbrepo.o -lstdc++
 -lm -lgcc -lc -lgcc
 dumbrepo.o: Undefined symbol `printer<1> virtual table' referenced from text
 segment
 dumbrepo.o: Undefined symbol `printer<1> virtual table' referenced from text
 segment
 collect2: ld returned 1 exit status

So the names are unmangled correctly, apparently, though eg++ is not called,
as it should.
The rpo file looks like:
M dumbrepo.C
D /home/espie/Projects/egcs
A '-frepo' '-c'
O __cl__Ct7printer1i1
O __vt_t7printer1i1
and c++filt yields:
M dumbrepo.C
D /home/espie/Projects/egcs
A '-frepo' '-c'
O printer<1>::_cl(void) const
O __vt_t7printer1i1

which is not very encouraging either.


Would you mind trying to build everything with -fsquangle (bootstrap & all) ?
We don't want to use -fsquangle for production yet, as this is likely to 
change from release to release, but if the bug does not show up with 
-fsquangle, a thorough understanding of what's going is not necessary. 

Relevant points of corresponding egcs configuration, as far as I can tell:
i386-unknown-openbsd, collect2=yes.

#define YES_UNDERSCORES
#include <i386/gstabs.h>
#include <i386/perform.h>
#define LINK_SPEC \
"%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
#define DBX_NO_XREFS
#define DEFAULT_VTABLE_THUNKS 1
#define DWARF2_UNWIND_INFO 0

plus ASM_OUTPUT_MI_THUNK taken from i386/unix.h,
DECLARE_FUNCTION*/DECLARE_OBJECT* taken from svr4.h


resulting assembler code:
------------------------
	.file	"dumbrepo.C"
gcc2_compiled.:
___gnu_compiled_cplusplus:
.text
LC0:
	.ascii "%d\12\0"
	.align 2,0x90
	.globl	_main
	.type	 _main,@function
_main:
	pushl %ebp
	movl %esp,%ebp
	subl $4,%esp
	pushl %ebx
	call ___main
	leal -4(%ebp),%eax
	pushl %eax
	call ___t7printer1i1
	addl $4,%esp
	leal -4(%ebp),%eax
	pushl %eax
	movl ___vt_t7printer1i1+8,%ebx
	call *%ebx
	addl $4,%esp
	xorl %eax,%eax
	jmp L7
	xorl %eax,%eax
	jmp L7
	.align 2,0x90
L7:
	movl -8(%ebp),%ebx
	leave
	ret
	.size	 _main,.-_main
	.align 2,0x90
	.weak	___t7printer1i1
	.type	 ___t7printer1i1,@function
___t7printer1i1:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%edx
	movl $___vt_t7printer1i1,(%edx)
L9:
	movl %edx,%eax
	jmp L8
L8:
	leave
	ret
	.size	 ___t7printer1i1,.-___t7printer1i1

passed thru c++filt:
---------
	.file	"dumbrepo.C"
gcc2_compiled.:
___gnu_compiled_cplusplus:
.text
LC0:
	.ascii "%d\12\0"
	.align 2,0x90
	.globl	_main
	.type	 _main,@function
_main:
	pushl %ebp
	movl %esp,%ebp
	subl $4,%esp
	pushl %ebx
	call ___main
	leal -4(%ebp),%eax
	pushl %eax
	call printer<1>::printer(void)
	addl $4,%esp
	leal -4(%ebp),%eax
	pushl %eax
	movl printer<1> virtual table+8,%ebx
	call *%ebx
	addl $4,%esp
	xorl %eax,%eax
	jmp L7
	xorl %eax,%eax
	jmp L7
	.align 2,0x90
L7:
	movl -8(%ebp),%ebx
	leave
	ret
	.size	 _main,.-_main
	.align 2,0x90
	.weak	printer<1>::printer(void)
	.type	 ___t7printer1i1,@function
___t7printer1i1:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%edx
	movl $___vt_t7printer1i1,(%edx)
L9:
	movl %edx,%eax
	jmp L8
L8:
	leave
	ret
	.size	 ___t7printer1i1,.-printer<1>::printer(void)


-- 
	Marc Espie		
|anime, sf, juggling, unicycle, acrobatics, comics...
|AmigaOS, OpenBSD, C++, perl, Icon, PostScript...
| `real programmers don't die, they just get out of beta'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]