1/****************************************************************************
2 *                                                                          *
3 *                         GNAT COMPILER COMPONENTS                         *
4 *                                                                          *
5 *                           I N I T I A L I Z E                            *
6 *                                                                          *
7 *                          C Implementation File                           *
8 *                                                                          *
9 *          Copyright (C) 1992-2014, Free Software Foundation, Inc.         *
10 *                                                                          *
11 * GNAT is free software;  you can  redistribute it  and/or modify it under *
12 * terms of the  GNU General Public License as published  by the Free Soft- *
13 * ware  Foundation;  either version 3,  or (at your option) any later ver- *
14 * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
15 * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
16 * or FITNESS FOR A PARTICULAR PURPOSE.                                     *
17 *                                                                          *
18 * As a special exception under Section 7 of GPL version 3, you are granted *
19 * additional permissions described in the GCC Runtime Library Exception,   *
20 * version 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 * GNAT was originally developed  by the GNAT team at  New York University. *
28 * Extensive contributions were provided by Ada Core Technologies Inc.      *
29 *                                                                          *
30 ****************************************************************************/
31
32/*  This unit provides default implementation for __gnat_initialize ()
33    which is called before the elaboration of the partition. It is provided
34    in a separate file/object so that users can replace it easily.
35    The default implementation should be null on most targets.  */
36
37/* The following include is here to meet the published VxWorks requirement
38   that the __vxworks header appear before any other include.  */
39#ifdef __vxworks
40#include "vxWorks.h"
41#endif
42
43#ifdef IN_RTS
44#include "tconfig.h"
45#include "tsystem.h"
46/* We don't have libiberty, so use malloc.  */
47#define xmalloc(S) malloc (S)
48#define xrealloc(V,S) realloc (V,S)
49#else
50#include "config.h"
51#include "system.h"
52#endif
53
54#include "raise.h"
55#include <fcntl.h>
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61/******************************************/
62/* __gnat_initialize (NT-mingw32 Version) */
63/******************************************/
64
65#if defined (__MINGW32__)
66
67extern void __gnat_install_SEH_handler (void *);
68
69void
70__gnat_initialize (void *eh ATTRIBUTE_UNUSED)
71{
72   /* Note that we do not activate this for the compiler itself to avoid a
73      bootstrap path problem.  Older version of gnatbind will generate a call
74      to __gnat_initialize() without argument. Therefore we cannot use eh in
75      this case.  It will be possible to remove the following #ifdef at some
76      point.  */
77#ifdef IN_RTS
78   /* Install the Structured Exception handler.  */
79   if (eh)
80     __gnat_install_SEH_handler (eh);
81#endif
82}
83
84/******************************************/
85/* __gnat_initialize (init_float version) */
86/******************************************/
87
88#elif defined (__Lynx__) || defined (__FreeBSD__) || defined(__NetBSD__) \
89  || defined (__OpenBSD__)
90
91void
92__gnat_initialize (void *eh ATTRIBUTE_UNUSED)
93{
94}
95
96/***************************************/
97/* __gnat_initialize (VxWorks Version) */
98/***************************************/
99
100#elif defined(__vxworks)
101
102void
103__gnat_initialize (void *eh)
104{
105}
106
107#elif defined(_T_HPUX10) || (!defined(IN_RTS) && defined(_X_HPUX10))
108
109/************************************************/
110/* __gnat_initialize (PA-RISC HP-UX 10 Version) */
111/************************************************/
112
113extern void __main (void);
114
115void
116__gnat_initialize (void *eh ATTRIBUTE_UNUSED)
117{
118  __main ();
119}
120
121#else
122
123/* For all other versions of GNAT, the initialize routine and handler
124   installation do nothing */
125
126/***************************************/
127/* __gnat_initialize (Default Version) */
128/***************************************/
129
130void
131__gnat_initialize (void *eh ATTRIBUTE_UNUSED)
132{
133}
134#endif
135
136#ifdef __cplusplus
137}
138#endif
139