--- libgcc2.c.orig	Fri Oct 21 13:13:56 1994
+++ libgcc2.c	Thu Dec 29 10:35:54 1994
@@ -1683,7 +1683,11 @@
   write (2, MESSAGE, sizeof (MESSAGE));
   /* don't call exit () because that may call global destructors which
      may cause a loop.  */
+#ifdef VXWORKS
+  exit(-1);
+#else
   _exit (-1);
+#endif /* VXWORKS */  
 }
 #endif
 
@@ -2022,6 +2026,17 @@
   DO_GLOBAL_CTORS_BODY;
   ON_EXIT (__do_global_dtors, 0);
 }
+#else
+#ifdef VXWORKS
+void
+__do_global_ctors ()
+{
+/*  DO_GLOBAL_CTORS_BODY;*/
+  func_ptr *p;
+  for (p = __CTOR_LIST__ + 1; *p; )
+    (*p++) ();
+}
+#endif /* VXWORKS */
 #endif /* no INIT_SECTION_ASM_OP */
 
 #if !defined (INIT_SECTION_ASM_OP) || defined (INVOKE__main)
@@ -2044,6 +2059,12 @@
       __do_global_ctors ();
     }
 }
+#else
+#ifdef VXWORKS
+SYMBOL__MAIN ()
+{
+}
+#endif /* VXWORKS */
 #endif /* no INIT_SECTION_ASM_OP or INVOKE__main */
 
 #endif /* L__main */
@@ -2059,6 +2080,12 @@
 
 /* We declare the lists here with two elements each,
    so that they are valid empty lists if no other definition is loaded.  */
+#ifdef VXWORKS
+#ifdef INIT_SECTION_ASM_OP
+#undef INIT_SECTION_ASM_OP
+#endif
+#endif
+
 #if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
 #ifdef __NeXT__
 /* After 2.3, try this definition on all systems.  */
@@ -2075,6 +2102,7 @@
 
 #include "gbl-ctors.h"
 
+#ifndef VXWORKS
 #ifndef ON_EXIT
 
 /* If we have no known way of registering our own __do_global_dtors
@@ -2097,11 +2125,19 @@
 #endif
   _exit (status);
 }
-
 #else
 int _exit_dummy_decl = 0;	/* prevent compiler & linker warnings */
 #endif
+#else /* VXWORKS */
+extern void __do_global_dtors ();
 
+void _exit(status)
+    int status;
+{
+  __do_global_dtors ();
+  exit(status);
+}
+#endif /* VXWORKS */
 #endif /* L_exit */
 
 /* In a.out systems, we need to have these dummy constructor and destructor

