]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - stdlib/exit.c
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[thirdparty/glibc.git] / stdlib / exit.c
index bc4cb0fd08530f2d6606f02afb93395df15b478a..ac247a1233c8b373e97fe90cd3a3b2c2b615da48 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,95,96,97,99,2001,2002,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991,95,96,97,99,2001,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <sysdep.h>
 #include "exit.h"
 
+#ifdef HAVE_GNU_LD
 #include "set-hooks.h"
 DEFINE_HOOK (__libc_atexit, (void))
+#endif
 
 
 /* Call all functions registered with `atexit' and `on_exit',
@@ -46,33 +47,17 @@ exit (int status)
            &__exit_funcs->fns[--__exit_funcs->idx];
          switch (f->flavor)
            {
-             void (*atfct) (void);
-             void (*onfct) (int status, void *arg);
-             void (*cxafct) (void *arg, int status);
-
            case ef_free:
            case ef_us:
              break;
            case ef_on:
-             onfct = f->func.on.fn;
-#ifdef PTR_DEMANGLE
-             PTR_DEMANGLE (onfct);
-#endif
-             onfct (status, f->func.on.arg);
+             (*f->func.on.fn) (status, f->func.on.arg);
              break;
            case ef_at:
-             atfct = f->func.at;
-#ifdef PTR_DEMANGLE
-             PTR_DEMANGLE (atfct);
-#endif
-             atfct ();
+             (*f->func.at) ();
              break;
            case ef_cxa:
-             cxafct = f->func.cxa.fn;
-#ifdef PTR_DEMANGLE
-             PTR_DEMANGLE (cxafct);
-#endif
-             cxafct (f->func.cxa.arg, status);
+             (*f->func.cxa.fn) (f->func.cxa.arg, status);
              break;
            }
        }
@@ -85,7 +70,14 @@ exit (int status)
        free (old);
     }
 
+#ifdef HAVE_GNU_LD
   RUN_HOOK (__libc_atexit, ());
+#else
+  {
+    extern void _cleanup (void);
+    _cleanup ();
+  }
+#endif
 
   _exit (status);
 }