This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs 10-31 and UnixWare
- To: robertl at dgii dot com (Robert Lipe)
- Subject: Re: egcs 10-31 and UnixWare
- From: hjl at lucon dot org (H.J. Lu)
- Date: Mon, 10 Nov 1997 11:24:22 -0800 (PST)
- Cc: law at cygnus dot com, acs at acm dot org, egcs at cygnus dot com, gcc2 at cygnus dot com, rr at sco dot com
>
> > > 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?
> > Hmmm, I don't know enough about the language to know how this is supposed
> > to be handled.
>
> I can see this as a grey area. Can anyone cite definitive sources
> for expected behaviour?
>
> > > /usr/tmp/cca003Pz.s:279:defined relocatable values from the same section re > quired, op -
> > Bummer. I suspect this is the funky way it we switch sections under
> > gcc's nose in crtstuff.
> >
> > Almost makes we wonder if we should be using section attributes to do
> > the switching (which gcc knows how to emit proper debug symbols for).
>
> If this is important, we can move this aspect to another thread.
> It was just an annoyance I thought I'd mention.
>
> > But I think you've hit the root of the problem -- it looks like we're
> > calling exit more than once, which seems to do bad things.
>
> Yes, and this is why removing HAVE_ATEXIT from my target made
> the test case pass becuase we weren't calling exit more than
> once.
>
> The attached program does different things on the three systems
> I tried it on.
>
> OpenServer 5: $ Calls two. Calls one. Calls exit. Calls abort.
> Solaris 2.3: Calls two. Calls one. Terminates normally. Exit val 1.
> Redhat 4.1/x86: Calls two. Calls one. Calls two. Call two. Repeats
> until stack size hits 8Mb ulimit. Faults.
>
I got the same result as Linux on Windows NT 4.0 with VC++ 5.0.
However I can change Linux to whatever behaviorw which makes
more senses.
How about call everyone on the list and use the status in the
last exit () call? BTW, it seems to be what happens on Solaris.
>
> If we decide that calling exit() from a destructor really is a
> questionable idea, we can just change the test case to call _exit()
> instead of exit() in the destructor and we can put HAVE_ATEXIT back
> in sco5.h.
>
> Now exactly how this ties into the Unixware stuff at this point,
> I'm unsure...
>
>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> void one(void)
> {
> printf("One\n");
> exit(1);
> }
>
> void two(void)
> {
> printf("two\n");
> }
>
>
> int main(void)
> {
> atexit(one);
> atexit(two);
> exit(1);
> }
>
>
--
H.J. Lu (hjl@gnu.ai.mit.edu)