This is the mail archive of the gcc-patches@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]

cure coff output on OSR5


As an indirect result of all the cleanups in ctor and dtor handling in
recent months, even "hello, world" on OpenServer 5 would drop core after
exit() but before the program terminated.  The mysterious part is that I
don't know why this ever worked...

On OpenServer (a halfbreed of ELF and COFF), crt1.o registers a _call_
to _fini (which is the first symbol in .fini) with atexit().  So when we
tear down, we jump to the .fini section.  This is consistent with most
ELF systems.  But in sco5.h, when generating COFF, we don't do things
the ELF way; we do them the COFF way.  This means we build a table of
pointers to functions that get sandwiched into _DTOR_LIST.  For the
last four years, we have been slamming __DTOR_LIST into .fini.  I have
no idea why the system hasn't been jumping to our table of function
pointers all this time.   The solution is to "hide" DTOR_LIST for COFF 
in a non-special section so that we can do our crtstuff thing.

Does this seem like the thing to do?  I could be convinced to go the
other way and make things more ELF-like.

I'm going to go ahead and commit this becuase it's less broken than
what's in there now.   If we have to fix it, I will.

RJL

        * i386/sco5.h (FINI_SECTION_ASM_OP_COFF): Move destructor fn
        table from .fini into .dtor.

Index: sco5.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/sco5.h,v
retrieving revision 1.30
diff -u -p -r1.30 sco5.h
--- sco5.h      1999/10/24 19:38:53     1.30
+++ sco5.h      1999/11/28 21:29:38
@@ -119,7 +119,7 @@ Boston, MA 02111-1307, USA.  */
 
 #undef FINI_SECTION_ASM_OP
 #define FINI_SECTION_ASM_OP_ELF                "\t.section\t.fini"
-#define FINI_SECTION_ASM_OP_COFF       "\t.section\t.fini, \"x\""
+#define FINI_SECTION_ASM_OP_COFF       "\t.section\t.dtor, \"x\""
 #define FINI_SECTION_ASM_OP    \
  ((TARGET_ELF) ? FINI_SECTION_ASM_OP_ELF : FINI_SECTION_ASM_OP_COFF)
 


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