This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 1008 segfaults in genattr
- To: hjl at lucon dot org (H.J. Lu)
- Subject: Re: 1008 segfaults in genattr
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Fri, 21 Nov 1997 20:49:17 -0800
- cc: acs at acm dot org, egcs at cygnus dot com, robertl at dgii dot com, jason at cygnus dot com
- Reply-To: law at cygnus dot com
In message <m0xYd7u-0004ecC@ocean.lucon.org>you write:
> __do_global_dtors_aux is called via the .fini section. Unless
> _fini (), the .fini section, is called twice, __do_global_dtors_aux
> should not be called twice.
Accoding to the comments before do_global_dtors_aux it can be called
more than once:
On some systems, this routine is run more than once from the .fini,
when exit is called recursively, so we arrange to remember where in
the list we left off processing, and we resume at that point,
should we be re-invoked. */
So apparently the code is supposed to handle this. I think we need to
debug _why_ the code is failing when it gets called the second time.
It sppears to me that __deregister_frame might abort if it runs twice
(frees some memory it might look at later), or if he objects array gets
wiped clean, then it could call abort.
This may not explain all the problems, but it gives us at least one to
look at.
Could someone try replacing __do_global_dtors_aux with this implementation
and try things?
static void
__do_global_dtors_aux ()
{
static func_ptr *p = __DTOR_LIST__ + 1;
static int completed = 0;
if (completed)
return
while (*p)
{
p++;
(*(p-1)) ();
}
#ifdef EH_FRAME_SECTION_ASM_OP
__deregister_frame (__EH_FRAME_BEGIN__);
#endif
completed = 1;
}
jeff