Home | History | Annotate | Line # | Download | only in rs6000
atexit.c revision 1.1.1.2.4.2
      1 /* Copyright (C) 1999-2018 Free Software Foundation, Inc.
      2 
      3    NOTE: This source is derived from an old version taken from the GNU C
      4    Library (glibc).
      5 
      6 This file is part of GCC.
      7 
      8 GCC is free software; you can redistribute it and/or modify it under
      9 the terms of the GNU General Public License as published by the Free
     10 Software Foundation; either version 3, or (at your option) any later
     11 version.
     12 
     13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
     14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
     15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     16 for more details.
     17 
     18 Under Section 7 of GPL version 3, you are granted additional
     19 permissions described in the GCC Runtime Library Exception, version
     20 3.1, as published by the Free Software Foundation.
     21 
     22 You should have received a copy of the GNU General Public License and
     23 a copy of the GCC Runtime Library Exception along with this program;
     24 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
     25 <http://www.gnu.org/licenses/>.  */
     26 
     27 #include <stdlib.h>
     28 #include "exit.h"
     29 
     30 
     31 /* This is defined by newer gcc version unique for each module.  */
     32 extern void *__dso_handle __attribute__ ((__weak__));
     33 
     34 
     35 /* Register FUNC to be executed by `exit'.  */
     36 int
     37 #ifndef atexit
     38 attribute_hidden
     39 #endif
     40 atexit (void (*func) (void))
     41 {
     42   return __cxa_atexit ((void (*) (void *)) func, NULL,
     43 		       &__dso_handle == NULL ? NULL : __dso_handle);
     44 }
     45