This is the mail archive of the gcc@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: 1008 segfaults in genattr


> > 4) Make the test case call _exit() instead of exit(), but just 
> > 	let code in the field learn this the hard way.
> 
> I think I'm going to go with #4.  

OK.  There's an implied "and put back have_atexit".

Please apply these patches:

Fri Nov 21 07:43:04 1997   Robert Lipe <robertl@dgii.com>
	* sco5.h: revert previous change.  The cost of picking up
	  more code from libgcc2 exceeds the cost of p9732b.C having
	  static destructors that call exit calling abort.

*** config/i386/sco5.h__    Fri Nov 21 07:42:03 1997
--- config/i386/sco5.h      Fri Nov 21 07:26:46 1997
***************
*** 930,933 ****
--- 930,934 ----
  # if defined (_SCO_ELF)
  #  define OBJECT_FORMAT_ELF
+ #  define HAVE_ATEXIT 1
  #  define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF
  #  define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF



Fri Nov 21 07:43:04 1997   Robert Lipe <robertl@dgii.com>
	* p9732b.C: Don't call exit from static destructors. Since
	we may be calling them via atexit, we want to avoid cleanup
	recursion.

*** testsuite/g++.old-deja/g++.mike/p9732b.C_   Tue Aug 19 02:34:53 1997
--- testsuite/g++.old-deja/g++.mike/p9732b.C    Fri Nov 21 07:47:13 1997
***************
*** 21,28 ****
      else
        {
        if (count != 0)
!         exit (1);
!       exit (0);
        }
    }
  } d;
--- 21,28 ----
      else
        {
        if (count != 0)
!         _exit (1);
!       _exit (0);
        }
    }
  } d;



> Shouldn't OpenServer COFF also define HAVE_ATEXIT?


Morally, yes, it should.

Even though it is, at that point, a COFF target, it still
has a _fini section that gets registered to execute via 
atexit().  

$ file crtendS.o ; dis crtendS.o | tail
crtendS.o:      iAPX 386 COFF object file not stripped - version 30821
          2b:  90                     nop

section .fini
.fini
__DTOR_END__
          2c:  00 00                  addb   %al,(%eax)
          2e:  00 00                  addb   %al,(%eax)
__FRAME_END__
          30:  00 00                  addb   %al,(%eax)
          32:  00 00                  addb   %al,(%eax)


As you can see, we are going to try to execute this (after we've done
all our destructors which is done first) we're headed for a SIGILL.

Can you help me untangle the right combination to get a useful
binary?  Between crtstuff.c and gbl-ctors.h and all the preprocessor
voodoo going on, I can't grok it.   There is much voodoo at the end 
of sco5.h to try to outsmart all the voodoo in the other two files.
I spent many hours on this when I first did it and just decide to 
punt this issue and let COFF not use ATEXIT.




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