This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Clean up generation of global variables in binder

Tested on i686-linux, committed on trunk.

Currently, the binder generates local variables to set run-time info
such as dispatching policy, time slicing, restriction info, etc...

These local variables are then passed to the run-time by a call to
__gnat_set_globals which then copies the values to variables inside
the run-time itself.

We need the final variables to be located within the run-time, since in the
case of shared libraries, we cannot have run-time units reference
variables located in the binder file (not visible when the shared libgnat is

But on the other hand, we do not need to have extra copies and the call to

Indeed, as part of implementing gnatbind -D, the binder modifies now
directly a variable in the run-time.

Furthermore, having to add regularly parameters to __gnat_set_globals
when we add new run-time parameters causes bootstrap problems,
see e.g. comment in init.c:

  /* ??? __gl_zero_cost_exceptions is new in 3.15 and is referenced from
     a-except.adb, which is also part of the compiler sources. Since the
     compiler is built with an older release of GNAT, the call generated by
     the old binder to this function does not provide any value for the    
     corresponding argument, so the global has to be initialized in some
     reasonable other way. This could be removed as soon as the next major
     release is out.  */                                                  

So this patch simplifies the code (avoid extra copy) and
avoids the bootstrap issues by having the binder generate file
set the __gl_* variables directly.

With this change, we also take the opportunity to remove elaboration code
from s-restri.adb by having the binder generated file directly
set the variable System.Restrictions.Run_Time_Restrictions.

2006-10-31  Arnaud Charlet  <>

	*, s-restri.adb: Mark this package as Preelaborate.
	Remove elaboration code, now done in the binder.

	* Make this unit Preelaborate.
	(No_Restrictions): New constant used to clean up code and follow
	preelaborate constraints.

	* s-stalib.adb: 
	Add System.Restrictions dependence, referenced directly from the
	binder generated file.

Attachment: difs
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]