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