source: rtems/cpukit/libcsupport/src/newlibc_exit.c @ 48dd7b8c

Last change on this file since 48dd7b8c was 48dd7b8c, checked in by Kinsey Moore <kinsey.moore@…>, on 06/29/20 at 19:35:08

score: Add CPU_USE_LIBC_INIT_FINI_ARRAY

This introduces the CPU_USE_LIBC_INIT_FINI_ARRAY define for use by CPU
ports to determine which global constructor and destructor methods are
used instead of placing architecture defines where they shouldn't be.

Close #4018

  • Property mode set to 100644
File size: 841 bytes
Line 
1/*
2 *  COPYRIGHT (c) 1994 by Division Incorporated
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.rtems.org/license/LICENSE.
7 *
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <rtems.h>
15
16#if defined(RTEMS_NEWLIB)
17#include <stdio.h>
18#include <unistd.h>
19
20  #if defined(__USE_INIT_FINI__)
21    #if CPU_USE_LIBC_INIT_FINI_ARRAY == TRUE
22      #define FINI_SYMBOL __libc_fini_array
23    #else
24      #define FINI_SYMBOL _fini
25    #endif
26
27    extern void FINI_SYMBOL( void );
28  #endif
29
30void _exit(int status)
31{
32  /*
33   *  If the toolset uses init/fini sections, then we need to
34   *  run the global destructors now.
35   */
36  #if defined(FINI_SYMBOL)
37    FINI_SYMBOL();
38  #endif
39
40  rtems_shutdown_executive(status);
41  /* does not return */
42}
43
44#endif
Note: See TracBrowser for help on using the repository browser.