crtstuff.c (__do_global_dtors_aux): Use atexit if no fini or fini_array section.
authorDouglas B Rupp <rupp@gnat.com>
Sat, 29 Aug 2009 15:37:48 +0000 (15:37 +0000)
committerDouglas Rupp <rupp@gcc.gnu.org>
Sat, 29 Aug 2009 15:37:48 +0000 (15:37 +0000)
* crtstuff.c (__do_global_dtors_aux): Use atexit if no
fini or fini_array section.

From-SVN: r151202

gcc/ChangeLog
gcc/crtstuff.c

index aec6044e238073934b7170c4355be4e160c6cb03..89ccac0cbbd8d477ee4b447ac72eaee982336c62 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-29  Douglas B Rupp  <rupp@gnat.com>
+
+       * crtstuff.c (__do_global_dtors_aux): Use atexit if no
+       fini or fini_array section.
+
 2009-08-28  Sebastian Pop  <sebastian.pop@amd.com>
 
        * graphite-dependences.c (graphite_legal_transform_bb): Call
index fb278bc446052586d43f3d0c0bee80de3c0192d3..6f8a8dd2d627a8233ffcc0f3dc3aca130b7e22d0 100644 (file)
@@ -325,11 +325,18 @@ __do_global_dtors_aux (void)
 /* Stick a call to __do_global_dtors_aux into the .fini section.  */
 #ifdef FINI_SECTION_ASM_OP
 CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
-#else /* !defined(FINI_SECTION_ASM_OP) */
+#elif defined (FINI_ARRAY_SECTION_ASM_OP)
 static func_ptr __do_global_dtors_aux_fini_array_entry[]
   __attribute__ ((__unused__, section(".fini_array")))
   = { __do_global_dtors_aux };
-#endif /* !defined(FINI_SECTION_ASM_OP) */
+#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
+static void __attribute__((used))
+__do_global_dtors_aux_1 (void)
+{
+  atexit (__do_global_dtors_aux);
+}
+CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_dtors_aux_1)
+#endif
 
 #if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME)
 /* Stick a call to __register_frame_info into the .init section.  For some