Commit 844e7daa by Doug Rupp Committed by Arnaud Charlet

Make-lang.in: Add initialize.o when needed.

2005-06-10  Doug Rupp  <rupp@adacore.com>
	    Arnaud Charlet  <charlet@adacore.com>
	    Olivier Hainque  <hainque@adacore.com>
	    Jose Ruiz  <ruiz@adacore.com>

	* Make-lang.in: Add initialize.o when needed.
	Remove obsolete references to RT_FLAGS.
	Add missing dependencies for sdefault.o

	* initialize.c: New file.

	* init.c [VMS] Declare ADA$ externs weak to fix build problem in IVMS.
	[VMS] cond_signal_table: Fix problem in declaration.
	[VMS] __gnat_error_handler: rewrite.
	Move all __gnat_initialize() routines to initialize.c
	Specialize the former "hpux" section to "hppa hpux", as this is what the
	section really is here for and we now have other hpux ports that need
	different contents.
	(__gnat_adjust_context_for_raise) i386-linux: First version of this
	function for this target. Adjust PC by one in the machine context. This
	adjustment was previously done in the MD_FALLBACK_FRAME_STATE_FOR, but
	it is more reliable to do that in the signal handler itself.
	(__gnat_install_handler) i386-linux: Set SA_SIGINFO in the sigaction
	flags, so that the handler is passed the context structure to adjust
	prior to the raise.
	(__gnat_error_handler) i386-linux: Adjust the signature to match what a
	SA_SIGINFO sigaction should look like. Call
	__gnat_adjust_context_for_raise before actually raising. Cleanup unused
	Machine_State_Operations stuff.
	Add conditional code so that the x86_64 is also supported.

From-SVN: r101047
parent 217efe16
# Top level -*- makefile -*- fragment for GNU Ada (GNAT).
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 Free Software Foundation, Inc.
#This file is part of GCC.
......@@ -105,7 +105,8 @@ ADA_TOOLS_FLAGS_TO_PASS=\
# Object files for gnat1 from C sources.
GNAT1_C_OBJS = ada/b_gnat1.o ada/adadecode.o ada/adaint.o ada/cstreams.o \
ada/cio.o ada/targtyps.o ada/decl.o ada/misc.o ada/utils.o ada/utils2.o \
ada/trans.o ada/cuintp.o ada/argv.o ada/raise.o ada/init.o ada/tracebak.o
ada/trans.o ada/cuintp.o ada/argv.o ada/raise.o ada/init.o ada/tracebak.o \
ada/initialize.o
# Object files from Ada sources that are used by gnat1
......@@ -162,6 +163,7 @@ GNATBIND_OBJS = \
ada/cstreams.o \
ada/final.o \
ada/init.o \
ada/initialize.o \
ada/seh_init.o \
ada/link.o \
ada/raise.o \
......@@ -942,7 +944,7 @@ ada/stamp-sdefault : $(srcdir)/version.c Makefile
ada/sdefault.o : ada/sdefault.ads ada/sdefault.adb ada/types.ads \
ada/unchdeal.ads ada/system.ads ada/s-exctab.ads ada/s-stalib.ads \
ada/unchconv.ads ada/osint.ads
ada/unchconv.ads ada/osint.ads ada/g-os_lib.ads ada/g-string.ads
ADA_TREE_H = ada/ada-tree.h ada/ada-tree.def
......@@ -1009,15 +1011,19 @@ ada/final.o : ada/final.c $(CONFIG_H) $(SYSTEM_H) ada/raise.h
ada/link.o : ada/link.c
ada/cio.o : ada/cio.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h
$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) $(RT_FLAGS) \
$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
ada/init.o : ada/init.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h ada/raise.h
$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) $(RT_FLAGS) \
$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
ada/initialize.o : ada/initialize.c
$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
ada/raise.o : ada/raise.c $(CONFIG_H) $(SYSTEM_H) ada/adaint.h ada/raise.h
$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) $(RT_FLAGS) \
$(CC) -c $(ALL_CFLAGS) $(ALL_ADA_CFLAGS) \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
# Need to keep the frame pointer in this file to pop the stack properly on
......
/****************************************************************************
* *
* GNAT COMPILER COMPONENTS *
* *
* I N I T I A L I Z E *
* *
* C Implementation File *
* *
* Copyright (C) 1992-2005, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
* ware Foundation; either version 2, or (at your option) any later ver- *
* sion. GNAT is distributed in the hope that it will be useful, but WITH- *
* OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
* for more details. You should have received a copy of the GNU General *
* Public License distributed with GNAT; see file COPYING. If not, write *
* to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
* MA 02111-1307, USA. *
* *
* As a special exception, if you link this file with other files to *
* produce an executable, this file does not by itself cause the resulting *
* executable to be covered by the GNU General Public License. This except- *
* ion does not however invalidate any other reasons why the executable *
* file might be covered by the GNU Public License. *
* *
* GNAT was originally developed by the GNAT team at New York University. *
* Extensive contributions were provided by Ada Core Technologies Inc. *
* *
****************************************************************************/
/* This unit provides default implementation for __gnat_initialize ()
which is called before the elaboration of the partition. It is provided
in a separate file/object so that users can replace it easily.
The default implementation should be null on most targets. */
/* The following include is here to meet the published VxWorks requirement
that the __vxworks header appear before any other include. */
#ifdef __vxworks
#include "vxWorks.h"
#endif
#ifdef IN_RTS
#include "tconfig.h"
#include "tsystem.h"
#else
#include "config.h"
#include "system.h"
#endif
#include "raise.h"
/******************************************/
/* __gnat_initialize (NT-mingw32 Version) */
/******************************************/
#if defined (__MINGW32__)
#include <windows.h>
extern void __gnat_init_float (void);
extern void __gnat_plist_init (void);
extern void __gnat_install_SEH_handler (void *);
void
__gnat_initialize (void *eh)
{
/* Initialize floating-point coprocessor. This call is needed because
the MS libraries default to 64-bit precision instead of 80-bit
precision, and we require the full precision for proper operation,
given that we have set Max_Digits etc with this in mind */
__gnat_init_float ();
/* Initialize a lock for a process handle list - see adaint.c for the
implementation of __gnat_portable_no_block_spawn, __gnat_portable_wait */
__gnat_plist_init();
/* Note that we do not activate this for the compiler itself to avoid a
bootstrap path problem. Older version of gnatbind will generate a call
to __gnat_initialize() without argument. Therefore we cannot use eh in
this case. It will be possible to remove the following #ifdef at some
point. */
#ifdef IN_RTS
/* Install the Structured Exception handler. */
if (eh)
__gnat_install_SEH_handler (eh);
#endif
}
/******************************************/
/* __gnat_initialize (init_float version) */
/******************************************/
#elif defined (__INTERIX) || defined (__Lynx__) || \
defined (__FreeBSD__) || defined(__NetBSD__)
extern void __gnat_init_float (void);
void
__gnat_initialize (void *eh ATTRIBUTE_UNUSED)
{
__gnat_init_float ();
}
/***************************************/
/* __gnat_initialize (VxWorks Version) */
/***************************************/
#elif defined(__vxworks)
extern void __gnat_init_float (void);
void
__gnat_initialize (void *eh)
{
__gnat_init_float ();
/* On targets where we might be using the ZCX scheme, we need to register
the frame tables.
For applications loaded as a set of "modules", the crtstuff objects
linked in (crtbegin/end) are tailored to provide this service a-la C++
constructor fashion, typically triggered by the VxWorks loader. This is
achieved by way of a special variable declaration in the crt object, the
name of which has been deduced by analyzing the output of the "munching"
step documented for C++. The de-registration is handled symetrically,
a-la C++ destructor fashion and typically triggered by the dynamic
unloader. Note that since the tables shall be registered against a
common datastructure, libgcc should be one of the modules (vs beeing
partially linked against all the others at build time) and shall be
loaded first.
For applications linked with the kernel, the scheme above would lead to
duplicated symbols because the VxWorks kernel build "munches" by default.
To prevent those conflicts, we link against crtbegin/endS objects that
don't include the special variable and directly call the appropriate
function here. We'll never unload that, so there is no de-registration to
worry about.
For whole applications loaded as a single module, we may use one scheme
or the other, except for the mixed Ada/C++ case in which the first scheme
would fail for the same reason as in the linked-with-kernel situation.
We can differentiate by looking at the __module_has_ctors value provided
by each class of crt objects. As of today, selecting the crt set with the
ctors/dtors capabilities (first scheme above) is triggered by adding
"-dynamic" to the gcc *link* command line options. Selecting the other
set of crt objects is achieved by "-static" instead.
This is a first approach, tightly synchronized with a number of GCC
configuration and crtstuff changes. We need to ensure that those changes
are there to activate this circuitry. */
#if (__GNUC__ >= 3) && (defined (_ARCH_PPC) || defined (__ppc))
{
/* The scheme described above is only useful for the actual ZCX case, and
we don't want any reference to the crt provided symbols otherwise. We
may not link with any of the crt objects in the non-ZCX case, e.g. from
documented procedures instructing the use of -nostdlib, and references
to the ctors symbols here would just remain unsatisfied.
We have no way to avoid those references in the right conditions in this
C module, because we have nothing like a IN_ZCX_RTS macro. This aspect
is then deferred to an Ada routine, which can do that based on a test
against a constant System flag value. */
extern void __gnat_vxw_setup_for_eh (void);
__gnat_vxw_setup_for_eh ();
}
#endif
}
#else
/* For all other versions of GNAT, the initialize routine and handler
installation do nothing */
/***************************************/
/* __gnat_initialize (Default Version) */
/***************************************/
void
__gnat_initialize (void *eh ATTRIBUTE_UNUSED)
{
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment