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]
Other format: [Raw text]

Re: [Janitor] Remove EXIT_BODY, NEED_ATEXIT, ON_EXIT


Zack Weinberg <zack@codesourcery.com> writes:

> Andreas Jaeger <aj@suse.de> writes:
>
>> The macros EXIT_BODY, NEED_ATEXIT, ON_EXIT are not defined anywhere, I
>> removed their usage.
>
> Yay.
>
>> The L_exit case is now really small, L_exit is needed only by
>> config/avr/t-avr, config/ip2k/t-ip2k and config/m68hc11/t-m68hc11-gas
>> (all implemented in assembler).  Do we still need this?
>
> I think that we still need the _exit routines defined by those three
> targets -- they appear to be deeply embedded boards with no libc at
> all -- but we do not need any L_exit stanza in libgcc2.c nor do we
> need any mention of it in mklibgcc.in.  That won't break those
> targets; they'll get it picked up by LIB1ASMFUNCS as usual.

That was what I expected, thanks for confirming it.

> This patch is OK, and a further patch to remove L_exit from libgcc2.c
> and mklibgcc.in is pre-approved.

Here's the ChangeLog and patch for these including the previous one.
I'll bootstrap now on i686-linux-gnu and commit after regtesting,

Andreas

2003-06-07  Andreas Jaeger  <aj@suse.de>

	* mklibgcc.in (lib2funcs): Remove _exit.
	* libgcc2.c: Remove L_exit.

============================================================
Index: gcc/mklibgcc.in
--- gcc/mklibgcc.in	6 Jun 2003 14:30:31 -0000	1.63
+++ gcc/mklibgcc.in	7 Jun 2003 17:30:05 -0000
@@ -48,7 +48,7 @@ lib2funcs='_muldi3 _negdi2 _lshrdi3 _ash
 	_cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
 	_fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi
 	_floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache
-	_trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 _addvdi3
+	_trampoline __main _absvsi2 _absvdi2 _addvsi3 _addvdi3
 	_subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors
 	_ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab
 	_popcountsi2 _popcountdi2 _paritysi2 _paritydi2'
============================================================
Index: gcc/libgcc2.c
--- gcc/libgcc2.c	4 Jun 2003 05:21:38 -0000	1.165
+++ gcc/libgcc2.c	7 Jun 2003 17:30:05 -0000
@@ -1668,79 +1668,4 @@ func_ptr __DTOR_LIST__[2];
 #endif
 #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
 #endif /* L_ctors */
-
-#ifdef L_exit
 
-#include "gbl-ctors.h"
-
-#ifdef NEED_ATEXIT
-
-#ifndef ON_EXIT
-
-# include <errno.h>
-
-static func_ptr *atexit_chain = 0;
-static long atexit_chain_length = 0;
-static volatile long last_atexit_chain_slot = -1;
-
-int
-atexit (func_ptr func)
-{
-  if (++last_atexit_chain_slot == atexit_chain_length)
-    {
-      atexit_chain_length += 32;
-      if (atexit_chain)
-	atexit_chain = (func_ptr *) realloc (atexit_chain, atexit_chain_length
-					     * sizeof (func_ptr));
-      else
-	atexit_chain = (func_ptr *) malloc (atexit_chain_length
-					    * sizeof (func_ptr));
-      if (! atexit_chain)
-	{
-	  atexit_chain_length = 0;
-	  last_atexit_chain_slot = -1;
-	  errno = ENOMEM;
-	  return (-1);
-	}
-    }
-  atexit_chain[last_atexit_chain_slot] = func;
-  return (0);
-}
-
-extern void _cleanup (void);
-extern void _exit (int) __attribute__ ((__noreturn__));
-
-void
-exit (int status)
-{
-  if (atexit_chain)
-    {
-      for ( ; last_atexit_chain_slot-- >= 0; )
-	{
-	  (*atexit_chain[last_atexit_chain_slot + 1]) ();
-	  atexit_chain[last_atexit_chain_slot + 1] = 0;
-	}
-      free (atexit_chain);
-      atexit_chain = 0;
-    }
-#ifdef EXIT_BODY
-  EXIT_BODY;
-#else
-  _cleanup ();
-#endif
-  _exit (status);
-}
-
-#else /* ON_EXIT */
-
-/* Simple; we just need a wrapper for ON_EXIT.  */
-int
-atexit (func_ptr func)
-{
-  return ON_EXIT (func);
-}
-
-#endif /* ON_EXIT */
-#endif /* NEED_ATEXIT */
-
-#endif /* L_exit */

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Attachment: pgp00000.pgp
Description: PGP signature


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