This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs 10-31 and UnixWare
- To: law at cygnus dot com
- Subject: Re: egcs 10-31 and UnixWare
- From: Robert Lipe <robertl at dgii dot com>
- Date: Sun, 9 Nov 1997 14:58:38 -0600
- Cc: acs at acm dot org, egcs at cygnus dot com, gcc2 at cygnus dot com, Ronald Joe Record <rr at sco dot com>
- References: <19971109131009.64698@dgii.com> <3946.879104378@hurl.cygnus.com>
> > Breakpoint 2, 0x800196c4 in exit ()
> > (gdb) cont
> > Continuing.
> >
> > Breakpoint 3, 0x80485a6 in __do_global_dtors_aux ()
> > (gdb) cont
> > Continuing.
> > --count
> > --count
> >
> > Breakpoint 2, 0x800196c4 in exit ()
> > (gdb) cont
> > Continuing.
> Wild. That shouldn't be happening.... I think we've got something
> to work backwards from now.
I didn't think so. :-)
> What about recompiling the crt* files with -g -O0 so you can get
> control of do_global_dtors_aux and possibly see how in the hell
> it's calling exit!
> Hmmm, maybe EH_FRAME_SECTION_ASM_OP isn't defined, and do_global_dtors_aux
> is actually finishing, which would drop us back into our friend fini_dummy.
It's definitely defined on OpenServer. When I disassemble
the binary, I can see the call to __de
08048580 <__do_global_dtors_aux>:
8048580: 55 pushl %ebp
8048581: 8b ec movl %esp,%ebp
8048583: 53 pushl %ebx
8048584: e8 00 00 00 00 call 8048589 <__do_global_dtors_aux+9>
8048589: 5b popl %ebx
804858a: 81 c3 fb 20 00 addl $0x20fb,%ebx
804858f: 00
8048590: eb 15 jmp 80485a7 <__do_global_dtors_aux+27>
8048592: 8b ff movl %edi,%edi
8048594: 8b 83 94 fa ff movl 0xfffffa94(%ebx),%eax
8048599: ff
804859a: 8d 50 04 leal 0x4(%eax),%edx
804859d: 89 93 94 fa ff movl %edx,0xfffffa94(%ebx)
80485a2: ff
80485a3: 8b 00 movl (%eax),%eax
80485a5: ff d0 call *%eax
80485a7: 8b 83 94 fa ff movl 0xfffffa94(%ebx),%eax
80485ac: ff
80485ad: 83 38 00 cmpl $0x0,(%eax)
80485b0: 75 e2 jne 8048594 <__do_global_dtors_aux+14>
80485b2: 8d 83 c4 fa ff leal 0xfffffac4(%ebx),%eax
80485b7: ff
80485b8: 50 pushl %eax
80485b9: e8 f2 08 00 00 call 8048eb0 <__deregister_frame>
80485be: 8b 5d fc movl 0xfffffffc(%ebp),%ebx
80485c1: 8b e5 movl %ebp,%esp
80485c3: 5d popl %ebp
80485c4: c3 ret
80485c5: 8d 76 00 leal 0x0(%esi),%esi
It's a little wierd that there's an opcode after the ret.
I don't think it's falling through. It looks like the problem is that
we're in an atexit() function (__do_global_dtors_aux) and it's calling
the destructor and the destructor is calling exit. Since exit() will
rip through the atexit() functions, isn't this bad?
Currently, the makefile generates these files liek this:
./xgcc -B./ -DIN_GCC -O2 -g -I./include -I. -I../../egcs-971023/gcc -I../..
/egcs-971023/gcc/config -g0 \
-finhibit-size-directive -fno-inline-functions -fno-exceptions \
-c ../../egcs-971023/gcc/crtstuff.c -DCRT_BEGIN -o crtbegin.o
./xgcc -B./ -DIN_GCC -O2 -g -I./include -I. -I../../egcs-971023/gcc -I../..
/egcs-971023/gcc/config -g0 \
-finhibit-size-directive -fno-inline-functions -fno-exceptions \
-c ../../egcs-971023/gcc/crtstuff.c -DCRT_END -o crtend.o
begin slight tangent...
If I change '-g0' to '-g', it dies during the build:
./xgcc -B./ -DIN_GCC -O2 -g -I./include -I. -I../../egcs-971023/gcc -I../..
/egcs-971023/gcc/config -g \
-finhibit-size-directive -fno-inline-functions -fno-exceptions \
-c ../../egcs-971023/gcc/crtstuff.c -DCRT_BEGIN -o crtbegin.o
/usr/tmp/cca003Pz.s:279:defined relocatable values from the same section require
d, op -
/usr/tmp/cca003Pz.s:287:defined relocatable values from the same section require
d, op -
/usr/tmp/cca003Pz.s:410:defined relocatable values from the same section require
d, op -
/usr/tmp/cca003Pz.s:418:defined relocatable values from the same section require
d, op -
If also I change BOOT_CFLAGS to -O0, it makes no difference.
Looking at the assembly file, it's croaking on the references to L_text_b
.section .line
.4byte 148 / /crtstuff.c:148
.2byte 0xffff
.4byte .L_LC12-.L_text_b
.previous
call __do_global_dtors_aux
.L_LC13:
L_text_b. is in the section .debug_aranges, .L_LC12 is in .text.
This seems to happen in the calls to asm(FINI_SECTION_ASM_OP)
If I run -g to -g1, it builds.
...end debug tangent.
Building crtstuff with this level of debugging makes the
backtrace more clearly frightening.
Program received signal SIGABRT, Aborted.
0x80019733 in _kill ()
(gdb) where
#0 0x80019733 in _kill ()
#1 0x8003df84 in abort ()
#2 0x8001d46f in _exithandle ()
#3 0x8003df56 in abort ()
#4 0x8001d46f in _exithandle ()
#5 0x800196d6 in exit ()
#6 0x80485a7 in __do_global_dtors_aux ()
#7 0x804905d in .fini ()
#8 0x800196d6 in exit ()
RJL