From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Lipe To: law@cygnus.com Cc: acs@acm.org, egcs@cygnus.com, gcc2@cygnus.com, Ronald Joe Record Subject: Re: egcs 10-31 and UnixWare Date: Sun, 09 Nov 1997 20:32:00 -0000 Message-id: <19971109223144.59098@dgii.com> References: <19971109145838.26288@dgii.com> <14350.879120281@hurl.cygnus.com> X-SW-Source: 1997-11/msg00338.html > > 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. 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 #include void one(void) { printf("One\n"); exit(1); } void two(void) { printf("two\n"); } int main(void) { atexit(one); atexit(two); exit(1); }