xref: /netbsd-src/external/gpl3/gcc.old/dist/libgcc/config/rs6000/atexit.c (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1*8feb0f0bSmrg /* Copyright (C) 1999-2020 Free Software Foundation, Inc.
236ac495dSmrg 
336ac495dSmrg    NOTE: This source is derived from an old version taken from the GNU C
436ac495dSmrg    Library (glibc).
536ac495dSmrg 
636ac495dSmrg This file is part of GCC.
736ac495dSmrg 
836ac495dSmrg GCC is free software; you can redistribute it and/or modify it under
936ac495dSmrg the terms of the GNU General Public License as published by the Free
1036ac495dSmrg Software Foundation; either version 3, or (at your option) any later
1136ac495dSmrg version.
1236ac495dSmrg 
1336ac495dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1436ac495dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
1536ac495dSmrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1636ac495dSmrg for more details.
1736ac495dSmrg 
1836ac495dSmrg Under Section 7 of GPL version 3, you are granted additional
1936ac495dSmrg permissions described in the GCC Runtime Library Exception, version
2036ac495dSmrg 3.1, as published by the Free Software Foundation.
2136ac495dSmrg 
2236ac495dSmrg You should have received a copy of the GNU General Public License and
2336ac495dSmrg a copy of the GCC Runtime Library Exception along with this program;
2436ac495dSmrg see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2536ac495dSmrg <http://www.gnu.org/licenses/>.  */
2636ac495dSmrg 
2736ac495dSmrg #include <stdlib.h>
2836ac495dSmrg #include "exit.h"
2936ac495dSmrg 
3036ac495dSmrg 
3136ac495dSmrg /* This is defined by newer gcc version unique for each module.  */
3236ac495dSmrg extern void *__dso_handle __attribute__ ((__weak__));
3336ac495dSmrg 
3436ac495dSmrg 
3536ac495dSmrg /* Register FUNC to be executed by `exit'.  */
3636ac495dSmrg int
3736ac495dSmrg #ifndef atexit
3836ac495dSmrg attribute_hidden
3936ac495dSmrg #endif
atexit(void (* func)(void))4036ac495dSmrg atexit (void (*func) (void))
4136ac495dSmrg {
4236ac495dSmrg   return __cxa_atexit ((void (*) (void *)) func, NULL,
4336ac495dSmrg 		       &__dso_handle == NULL ? NULL : __dso_handle);
4436ac495dSmrg }
45