| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT RUN-TIME COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- T A R G P A R M -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1999-2025, 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. See the GNU General Public License -- |
| 17 |
-- for more details. You should have received a copy of the GNU General -- |
| 18 |
-- Public License distributed with GNAT; see file COPYING3. If not, go to -- |
| 19 |
-- http://www.gnu.org/licenses for a complete copy of the license. -- |
| 20 |
-- -- |
| 21 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 22 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 23 |
-- -- |
| 24 |
------------------------------------------------------------------------------ |
| 25 |
|
| 26 |
-- This package obtains parameters from the target runtime version of System, |
| 27 |
-- to indicate parameters relevant to the target environment. |
| 28 |
|
| 29 |
-- Conceptually, these parameters could be obtained using rtsfind, but |
| 30 |
-- we do not do this for four reasons: |
| 31 |
|
| 32 |
-- 1. Compiling System for every compilation wastes time |
| 33 |
|
| 34 |
-- 2. This compilation impedes debugging by adding extra compile steps |
| 35 |
|
| 36 |
-- 3. There are recursion problems coming from compiling System itself |
| 37 |
-- or any of its children. |
| 38 |
|
| 39 |
-- 4. The binder also needs the parameters, and we do not want to have |
| 40 |
-- to drag a lot of front end stuff into the binder. |
| 41 |
|
| 42 |
-- For all these reasons, we read in the source of System, and then scan |
| 43 |
-- it at the text level to extract the parameter values. |
| 44 |
|
| 45 |
-- Note however, that later on, when the ali file is written, we make sure |
| 46 |
-- that the System file is at least parsed, so that the checksum is properly |
| 47 |
-- computed and set in the ali file. This partially negates points 1 and 2 |
| 48 |
-- above although just parsing is quick and does not impact debugging much. |
| 49 |
|
| 50 |
-- The parameters acquired by this routine from system.ads fall into four |
| 51 |
-- categories: |
| 52 |
|
| 53 |
-- 1. Configuration pragmas, that must appear at the start of the file. |
| 54 |
-- Any such pragmas automatically apply to any unit compiled in the |
| 55 |
-- presence of this system file. Only a limited set of such pragmas |
| 56 |
-- may appear as documented in the corresponding section below. |
| 57 |
|
| 58 |
-- 2. Target parameters. These are boolean constants that are defined |
| 59 |
-- in the private part of the package giving fixed information |
| 60 |
-- about the target architecture, and the capabilities of the |
| 61 |
-- code generator and run-time library. |
| 62 |
|
| 63 |
-- 3. Identification information. This is an optional string constant |
| 64 |
-- that gives the name of the run-time library configuration. This |
| 65 |
-- line may be omitted for a version of system.ads to be used with |
| 66 |
-- the full Ada 95 run time. |
| 67 |
|
| 68 |
-- 4. Other characteristics of package System. At the current time the |
| 69 |
-- only item in this category is whether type Address is private. |
| 70 |
|
| 71 |
with Rident; use Rident; |
| 72 |
with Namet; use Namet; |
| 73 |
with Types; use Types; |
| 74 |
|
| 75 |
package Targparm is |
| 76 |
|
| 77 |
--------------------------- |
| 78 |
-- Configuration Pragmas -- |
| 79 |
--------------------------- |
| 80 |
|
| 81 |
-- The following switches get set if the corresponding configuration |
| 82 |
-- pragma is scanned from the source of system.ads. No other pragmas |
| 83 |
-- are permitted to appear at the start of the system.ads source file. |
| 84 |
|
| 85 |
-- If a pragma Discard_Names appears, then Opt.Global_Discard_Names is |
| 86 |
-- set to True to indicate that all units must be compiled in this mode. |
| 87 |
|
| 88 |
-- If a pragma Locking_Policy appears, then Opt.Locking_Policy is set |
| 89 |
-- to the first character of the policy name, and Opt.Locking_Policy_Sloc |
| 90 |
-- is set to System_Location. |
| 91 |
|
| 92 |
-- If a pragma Normalize_Scalars appears, then Opt.Normalize_Scalars |
| 93 |
-- is set True, as well as Opt.Init_Or_Norm_Scalars. |
| 94 |
|
| 95 |
-- If a pragma Queuing_Policy appears, then Opt.Queuing_Policy is set |
| 96 |
-- to the first character of the policy name, and Opt.Queuing_Policy_Sloc |
| 97 |
-- is set to System_Location. |
| 98 |
|
| 99 |
-- If a pragma Task_Dispatching_Policy appears, then the flag |
| 100 |
-- Opt.Task_Dispatching_Policy is set to the first character of the |
| 101 |
-- policy name, and Opt.Task_Dispatching_Policy_Sloc is set to |
| 102 |
-- System_Location. |
| 103 |
|
| 104 |
-- If a pragma Detect_Blocking appears, then the flag Opt.Detect_Blocking |
| 105 |
-- is set to True. |
| 106 |
|
| 107 |
-- If a pragma Suppress_Exception_Locations appears, then the flag |
| 108 |
-- Opt.Exception_Locations_Suppressed is set to True. |
| 109 |
|
| 110 |
-- If a pragma Profile with a valid profile argument appears, then |
| 111 |
-- the appropriate restrictions and policy flags are set. |
| 112 |
|
| 113 |
-- pragma Style_Checks is allowed with "On" or "Off" as an argument, in |
| 114 |
-- order to make the conditions on pragma Restrictions documented in the |
| 115 |
-- next paragraph easier to manage. |
| 116 |
|
| 117 |
-- The only other pragma allowed is a pragma Restrictions that specifies |
| 118 |
-- a restriction that will be imposed on all units in the partition. Note |
| 119 |
-- that in this context, only one restriction can be specified in a single |
| 120 |
-- pragma, and the pragma must appear on its own on a single source line. |
| 121 |
|
| 122 |
-- If package System contains exactly the line "type Address is private;" |
| 123 |
-- then the flag Opt.Address_Is_Private is set True, otherwise this flag |
| 124 |
-- is set False. |
| 125 |
|
| 126 |
Restrictions_On_Target : Restrictions_Info := No_Restrictions; |
| 127 |
-- Records restrictions specified by system.ads. Only the Set and Value |
| 128 |
-- members are modified. The Violated and Count fields are never modified. |
| 129 |
-- Note that entries can be set either by a pragma Restrictions or by |
| 130 |
-- a pragma Profile. |
| 131 |
|
| 132 |
------------------- |
| 133 |
-- Run Time Name -- |
| 134 |
------------------- |
| 135 |
|
| 136 |
-- This parameter should be regarded as read only by all clients of |
| 137 |
-- of package. The only way they get modified is by calling the |
| 138 |
-- Get_Target_Parameters routine which reads the values from a provided |
| 139 |
-- text buffer containing the source of the system package. |
| 140 |
|
| 141 |
-- The corresponding string constant is placed immediately at the start |
| 142 |
-- of the private part of system.ads if is present, e.g. in the form: |
| 143 |
|
| 144 |
-- Run_Time_Name : constant String := "Zero Footprint Run Time"; |
| 145 |
|
| 146 |
-- the corresponding messages will look something like |
| 147 |
|
| 148 |
-- xxx not supported (Zero Footprint Run Time) |
| 149 |
|
| 150 |
Run_Time_Name_On_Target : Name_Id := No_Name; |
| 151 |
-- Set to appropriate names table entry Id value if a Run_Time_Name |
| 152 |
-- string constant is defined in system.ads. This name is used only |
| 153 |
-- for the configurable run-time case, and is used to parameterize |
| 154 |
-- messages that complain about non-supported run-time features. |
| 155 |
-- The name should contain only letters A-Z, digits 1-9, spaces, |
| 156 |
-- and underscores. |
| 157 |
|
| 158 |
-------------------------- |
| 159 |
-- Executable Extension -- |
| 160 |
-------------------------- |
| 161 |
|
| 162 |
Executable_Extension_On_Target : Name_Id := No_Name; |
| 163 |
-- Executable extension on the target. This name is useful for setting |
| 164 |
-- the executable extension in a dynamic way, e.g. depending on the |
| 165 |
-- run time used, rather than using a configure-time macro as done by |
| 166 |
-- Get_Target_Executable_Suffix. If not set (No_Name), instead use |
| 167 |
-- System.OS_Lib.Get_Target_Executable_Suffix. |
| 168 |
|
| 169 |
----------------------- |
| 170 |
-- Target Parameters -- |
| 171 |
----------------------- |
| 172 |
|
| 173 |
-- The following parameters correspond to the variables defined in the |
| 174 |
-- private part of System (without the terminating _On_Target). Note |
| 175 |
-- that it is required that all parameters defined here be specified |
| 176 |
-- in the target specific version of system.ads. Thus, to add a new |
| 177 |
-- parameter, add it to all system*.ads files. (There is a defaulting |
| 178 |
-- mechanism, but we don't normally take advantage of it, as explained |
| 179 |
-- below.) |
| 180 |
|
| 181 |
-- The default values here are used if no value is found in system.ads. |
| 182 |
-- This should normally happen if the special version of system.ads used |
| 183 |
-- by the compiler itself is in use or if the value is only relevant to a |
| 184 |
-- particular target. The default values are suitable for use in normal |
| 185 |
-- environments. This approach allows the possibility of new versions of |
| 186 |
-- the compiler (possibly with new system parameters added) being used to |
| 187 |
-- compile older versions of the compiler sources, as well as avoiding |
| 188 |
-- duplicating values in all system-*.ads files for flags that are used on |
| 189 |
-- a few platforms only. |
| 190 |
|
| 191 |
-- All these parameters should be regarded as read only by all clients |
| 192 |
-- of the package. The only way they get modified is by calling the |
| 193 |
-- Get_Target_Parameters routine which reads the values from a provided |
| 194 |
-- text buffer containing the source of the system package. |
| 195 |
|
| 196 |
------------------------------- |
| 197 |
-- Backend Arithmetic Checks -- |
| 198 |
------------------------------- |
| 199 |
|
| 200 |
-- Divide and overflow checks are either done in the front end or |
| 201 |
-- back end. The front end will generate checks when required unless |
| 202 |
-- the corresponding parameter here is set to indicate that the back |
| 203 |
-- end will generate the required checks (or that the checks are |
| 204 |
-- automatically performed by the hardware in an appropriate form). |
| 205 |
|
| 206 |
Backend_Divide_Checks_On_Target : Boolean := False; |
| 207 |
-- Set True if the back end generates divide checks, or if the hardware |
| 208 |
-- checks automatically. Set False if the front end must generate the |
| 209 |
-- required tests using explicit expanded code. |
| 210 |
|
| 211 |
Backend_Overflow_Checks_On_Target : Boolean := False; |
| 212 |
-- Set True if the back end generates arithmetic overflow checks, or if |
| 213 |
-- the hardware checks automatically. Set False if the front end must |
| 214 |
-- generate the required tests using explicit expanded code. |
| 215 |
|
| 216 |
----------------------------------- |
| 217 |
-- Control of Exception Handling -- |
| 218 |
----------------------------------- |
| 219 |
|
| 220 |
-- GNAT provides two methods of implementing exceptions: |
| 221 |
|
| 222 |
-- Back-End Zero Cost Exceptions |
| 223 |
|
| 224 |
-- With this approach, the back end handles the generation and |
| 225 |
-- handling of exceptions. For example, the GCC3 exception handling |
| 226 |
-- mechanisms are used in this mode. The front end simply generates |
| 227 |
-- code for explicit exception handlers, and AT-END cleanup handlers |
| 228 |
-- are simply passed unchanged to the backend for generating cleanups |
| 229 |
-- both in the exceptional and non-exceptional cases. |
| 230 |
|
| 231 |
-- As the name implies, this approach uses a table-based mechanism, |
| 232 |
-- which incurs no setup when entering a region covered by handlers |
| 233 |
-- but requires complex unwinding to walk up the call chain and search |
| 234 |
-- for handlers at propagation time. |
| 235 |
|
| 236 |
-- Back-End Setjmp/Longjmp Exceptions |
| 237 |
|
| 238 |
-- With this approach, the back end also handles the generation and |
| 239 |
-- handling of exceptions, using setjmp/longjmp to set up receivers and |
| 240 |
-- propagate. AT-END actions on exceptional paths are also taken care |
| 241 |
-- of by the back end and the front end doesn't need to generate |
| 242 |
-- explicit exception handlers for these. |
| 243 |
|
| 244 |
-- Control of Available Methods and Defaults |
| 245 |
|
| 246 |
-- The following switch specifies whether this is a zero-cost or a sjlj |
| 247 |
-- scheme. |
| 248 |
|
| 249 |
-- The default value corresponds to the default value of |
| 250 |
-- Opt.Exception_Mechanism. |
| 251 |
|
| 252 |
ZCX_By_Default_On_Target : Boolean := False; |
| 253 |
-- Indicates if zero cost scheme for exceptions |
| 254 |
|
| 255 |
------------------------------------ |
| 256 |
-- Run-Time Library Configuration -- |
| 257 |
------------------------------------ |
| 258 |
|
| 259 |
-- In configurable run-time mode, the system run-time may not support |
| 260 |
-- the full Ada language. The effect of setting this switch is to let |
| 261 |
-- the compiler know that it is not surprising (i.e. the system is not |
| 262 |
-- misconfigured) if run-time library units or entities within units are |
| 263 |
-- not present in the run-time. |
| 264 |
|
| 265 |
Configurable_Run_Time_On_Target : Boolean := False; |
| 266 |
-- Indicates that the system.ads file is for a configurable run-time |
| 267 |
-- |
| 268 |
-- This has some specific effects as follows |
| 269 |
-- |
| 270 |
-- The binder generates the gnat_argc/argv/envp variables in the |
| 271 |
-- binder file instead of being imported from the run-time library. |
| 272 |
-- If Command_Line_Args_On_Target is set to False, then the |
| 273 |
-- generation of these variables is suppressed completely. |
| 274 |
-- |
| 275 |
-- The routine __gnat_break_start is defined within the binder file |
| 276 |
-- instead of being imported from the run-time library. |
| 277 |
|
| 278 |
Suppress_Standard_Library_On_Target : Boolean := False; |
| 279 |
-- If this flag is True, then the standard library is not included by |
| 280 |
-- default in the executable (see unit System.Standard_Library in file |
| 281 |
-- s-stalib.ads for details of what this includes). This is for example |
| 282 |
-- set True for the zero foot print case, where these files should not |
| 283 |
-- be included by default. |
| 284 |
-- |
| 285 |
-- This flag has some other related effects: |
| 286 |
-- |
| 287 |
-- The generation of global variables in the bind file is suppressed, |
| 288 |
-- with the exception of the priority of the environment task, which |
| 289 |
-- is needed by the Ravenscar run-time. |
| 290 |
-- |
| 291 |
-- The calls to __gnat_initialize and __gnat_finalize are omitted |
| 292 |
-- |
| 293 |
-- All finalization and initialization (controlled types) is omitted |
| 294 |
|
| 295 |
Preallocated_Stacks_On_Target : Boolean := False; |
| 296 |
-- If this flag is True, then the expander preallocates all task stacks |
| 297 |
-- at compile time. If the flag is False, then task stacks are not pre- |
| 298 |
-- allocated, and task stack allocation is the responsibility of the |
| 299 |
-- run-time (which typically delegates the task to the underlying |
| 300 |
-- operating system environment). |
| 301 |
|
| 302 |
--------------------- |
| 303 |
-- Duration Format -- |
| 304 |
--------------------- |
| 305 |
|
| 306 |
-- By default, type Duration is a 64-bit fixed-point type with a delta |
| 307 |
-- and small of 10**(-9) (i.e. it is a count in nanoseconds). This flag |
| 308 |
-- allows that standard format to be modified. |
| 309 |
|
| 310 |
Duration_32_Bits_On_Target : Boolean := False; |
| 311 |
-- If True, then Duration is represented in 32 bits and the delta and |
| 312 |
-- small values are set to 20.0*(10**(-3)) (i.e. it is a count in units |
| 313 |
-- of 20 milliseconds). |
| 314 |
|
| 315 |
------------------------------------ |
| 316 |
-- Back-End Code Generation Flags -- |
| 317 |
------------------------------------ |
| 318 |
|
| 319 |
-- These flags indicate possible limitations in what the code generator |
| 320 |
-- can handle. They will all be True for a full run-time, but one or more |
| 321 |
-- of these may be false for a configurable run-time, and if a feature is |
| 322 |
-- used at the source level, and the corresponding flag is false, then an |
| 323 |
-- error message will be issued saying the feature is not supported. |
| 324 |
|
| 325 |
Atomic_Sync_Default_On_Target : Boolean := True; |
| 326 |
-- Access to atomic variables requires memory barrier synchronization in |
| 327 |
-- the general case to ensure proper behavior when such accesses are used |
| 328 |
-- on a multiprocessor to synchronize tasks (e.g. by using spin locks). |
| 329 |
-- The setting of this flag determines the default behavior. Normally this |
| 330 |
-- is True, which will mean that appropriate synchronization instructions |
| 331 |
-- are generated by default. If it is False, then the default will be that |
| 332 |
-- these synchronization instructions are not generated. This may be a more |
| 333 |
-- appropriate default in some cases, e.g. on embedded targets which do not |
| 334 |
-- allow the possibility of multiprocessors. The default can be overridden |
| 335 |
-- using pragmas Disable/Enable_Atomic_Synchronization and also by use of |
| 336 |
-- the corresponding debug flags -gnatd.e and -gnatd.d. |
| 337 |
|
| 338 |
Support_Aggregates_On_Target : Boolean := True; |
| 339 |
-- In the general case, the use of aggregates may generate calls |
| 340 |
-- to run-time routines in the C library, including memset, memcpy, |
| 341 |
-- memmove, and bcopy. This flag is set to True if these routines |
| 342 |
-- are available. If any of these routines is not available, then |
| 343 |
-- this flag is False, and the use of aggregates is not permitted. |
| 344 |
|
| 345 |
Support_Atomic_Primitives_On_Target : Boolean := False; |
| 346 |
-- If this flag is True, then the back end supports GCC built-in atomic |
| 347 |
-- operations for memory model, such as atomic load or atomic compare |
| 348 |
-- exchange (see the GCC manual for more information). If the flag is |
| 349 |
-- False, then the back end doesn't provide this support. Note that this |
| 350 |
-- flag is set to True only if the target supports all atomic primitives |
| 351 |
-- up to 64 bits. |
| 352 |
|
| 353 |
Support_Composite_Assign_On_Target : Boolean := True; |
| 354 |
-- The assignment of composite objects other than small records and |
| 355 |
-- arrays whose size is 64-bits or less and is set by an explicit |
| 356 |
-- size clause may generate calls to memcpy, memmove, and bcopy. |
| 357 |
-- If versions of all these routines are available, then this flag |
| 358 |
-- is set to True. If any of these routines is not available, then |
| 359 |
-- the flag is set False, and composite assignments are not allowed. |
| 360 |
|
| 361 |
Support_Composite_Compare_On_Target : Boolean := True; |
| 362 |
-- If this flag is True, then the back end supports byte-wise comparison |
| 363 |
-- of arrays for equality operations and lexicographic comparison of 1- |
| 364 |
-- dimensional arrays of bytes for ordering operations, either by means |
| 365 |
-- of generating inline code or calling appropriate routines like memcmp. |
| 366 |
-- If this flag is False, then the back end does not provide this support, |
| 367 |
-- and the front end uses component by component comparison for arrays. |
| 368 |
|
| 369 |
Support_Long_Shifts_On_Target : Boolean := True; |
| 370 |
-- If True, the back end supports 64-bit shift operations. If False, then |
| 371 |
-- the source program may not contain explicit 64-bit shifts. In addition, |
| 372 |
-- the code generated for packed arrays will avoid the use of long shifts. |
| 373 |
|
| 374 |
Support_Nondefault_SSO_On_Target : Boolean := True; |
| 375 |
-- If True, the back end supports the non-default Scalar_Storage_Order |
| 376 |
-- (i.e. allows non-confirming Scalar_Storage_Order attribute definition |
| 377 |
-- clauses). |
| 378 |
|
| 379 |
-------------------- |
| 380 |
-- Indirect Calls -- |
| 381 |
-------------------- |
| 382 |
|
| 383 |
Always_Compatible_Rep_On_Target : Boolean := True; |
| 384 |
-- If True, the Can_Use_Internal_Rep flag (see Einfo) is set to False in |
| 385 |
-- all cases. This corresponds to the traditional code generation |
| 386 |
-- strategy. False allows the front end to choose a policy that partly or |
| 387 |
-- entirely eliminates dynamically generated trampolines. |
| 388 |
|
| 389 |
------------------------------- |
| 390 |
-- Control of Stack Checking -- |
| 391 |
------------------------------- |
| 392 |
|
| 393 |
-- GNAT provides three methods of implementing stack checking: |
| 394 |
|
| 395 |
-- GCC Probing Mechanism |
| 396 |
|
| 397 |
-- This approach uses the standard GCC mechanism for |
| 398 |
-- stack checking. The method assumes that accessing |
| 399 |
-- storage immediately beyond the end of the stack |
| 400 |
-- will result in a trap that is converted to a storage |
| 401 |
-- error by the runtime system. This mechanism has |
| 402 |
-- minimal overhead, but requires complex hardware, |
| 403 |
-- operating system and run-time support. Probing is |
| 404 |
-- the default method where it is available. The stack |
| 405 |
-- size for the environment task depends on the operating |
| 406 |
-- system and cannot be set in a system-independent way. |
| 407 |
|
| 408 |
-- GCC Stack-limit Mechanism |
| 409 |
|
| 410 |
-- This approach uses the GCC stack limits mechanism. |
| 411 |
-- It relies on comparing the stack pointer with the |
| 412 |
-- values of a global symbol. If the check fails, a |
| 413 |
-- trap is explicitly generated. The advantage is |
| 414 |
-- that the mechanism requires no memory protection, |
| 415 |
-- but operating system and run-time support are |
| 416 |
-- needed to manage the per-task values of the symbol. |
| 417 |
-- This is the default method after probing where it |
| 418 |
-- is available. |
| 419 |
|
| 420 |
-- GNAT Stack-limit Checking |
| 421 |
|
| 422 |
-- This method relies on comparing the stack pointer |
| 423 |
-- with per-task stack limits. If the check fails, an |
| 424 |
-- exception is explicitly raised. The advantage is |
| 425 |
-- that the method requires no extra system dependent |
| 426 |
-- runtime support and can be used on systems without |
| 427 |
-- memory protection as well, but at the cost of more |
| 428 |
-- overhead for doing the check. This is the fallback |
| 429 |
-- method if the above two are not supported. |
| 430 |
|
| 431 |
Stack_Check_Probes_On_Target : Boolean := False; |
| 432 |
-- Indicates if the GCC probing mechanism is used |
| 433 |
|
| 434 |
-- WARNING: There is a matching C declaration of this variable in fe.h |
| 435 |
|
| 436 |
Stack_Check_Limits_On_Target : Boolean := False; |
| 437 |
-- Indicates if the GCC stack-limit mechanism is used |
| 438 |
|
| 439 |
-- Both flags cannot be simultaneously set to True. If neither |
| 440 |
-- is, the target independent fallback method is used. |
| 441 |
|
| 442 |
-- WARNING: There is a matching C declaration of this variable in fe.h |
| 443 |
|
| 444 |
Stack_Check_Default_On_Target : Boolean := False; |
| 445 |
-- Indicates if stack checking is on by default |
| 446 |
|
| 447 |
---------------------------- |
| 448 |
-- Command Line Arguments -- |
| 449 |
---------------------------- |
| 450 |
|
| 451 |
-- Command line arguments are supported on most targets. The following flag |
| 452 |
-- is set to False for targets that do not support command line arguments |
| 453 |
-- (i.e. VxWorks). Note that support for command line arguments is not |
| 454 |
-- required on such targets (RM A.15(13)). |
| 455 |
|
| 456 |
Command_Line_Args_On_Target : Boolean := True; |
| 457 |
-- Set False if no command line arguments on target. This will suppress |
| 458 |
-- generation of references to the argv/argc variables used to record |
| 459 |
-- command line arguments. |
| 460 |
|
| 461 |
-- Similarly, most targets support the use of an exit status, but other |
| 462 |
-- targets might not, as allowed by RM A.15(18-20). |
| 463 |
|
| 464 |
Exit_Status_Supported_On_Target : Boolean := True; |
| 465 |
-- Set False if returning of an exit status is not supported on target. |
| 466 |
-- This will cause the binder to not generate a reference to the |
| 467 |
-- gnat_exit_status run-time symbol. |
| 468 |
|
| 469 |
----------------------- |
| 470 |
-- Main Program Name -- |
| 471 |
----------------------- |
| 472 |
|
| 473 |
-- When the binder generates the main program to be used to create the |
| 474 |
-- executable, the main program name is main by default (to match the |
| 475 |
-- usual Unix practice). If this parameter is set to True, then the |
| 476 |
-- name is instead by default taken from the actual Ada main program |
| 477 |
-- name (just the name of the child if the main program is a child unit). |
| 478 |
-- In either case, this value can be overridden using -M name. |
| 479 |
|
| 480 |
Use_Ada_Main_Program_Name_On_Target : Boolean := False; |
| 481 |
-- Set True to use the Ada main program name as the main name |
| 482 |
|
| 483 |
---------------------------------------------- |
| 484 |
-- Boolean-Valued Floating-Point Attributes -- |
| 485 |
---------------------------------------------- |
| 486 |
|
| 487 |
-- The constants below give the values for representation oriented |
| 488 |
-- floating-point attributes that are the same for all float types |
| 489 |
-- on the target. These are all boolean values. |
| 490 |
|
| 491 |
-- A value is only True if the target reliably supports the corresponding |
| 492 |
-- feature. Reliably here means that support is guaranteed for all |
| 493 |
-- possible settings of the relevant compiler switches (like -mieee), |
| 494 |
-- since we cannot control the user setting of those switches. |
| 495 |
|
| 496 |
-- The attributes cannot dependent on the current setting of compiler |
| 497 |
-- switches, since the values must be static and consistent throughout |
| 498 |
-- the partition. We probably should add such consistency checks in future, |
| 499 |
-- but for now we don't do this. |
| 500 |
|
| 501 |
-- Note: the compiler itself does not use floating-point, so the |
| 502 |
-- settings of the defaults here are not really relevant. |
| 503 |
|
| 504 |
-- Note: in some cases, proper support of some of these floating point |
| 505 |
-- features may require a specific switch (e.g. -mieee on the Alpha) |
| 506 |
-- to be used to obtain full RM compliant support. |
| 507 |
|
| 508 |
Denorm_On_Target : Boolean := False; |
| 509 |
-- Set to False on targets that do not reliably support denormals |
| 510 |
|
| 511 |
Machine_Rounds_On_Target : Boolean := True; |
| 512 |
-- Set to False for targets where S'Machine_Rounds is False |
| 513 |
|
| 514 |
Machine_Overflows_On_Target : Boolean := False; |
| 515 |
-- Set to True for targets where S'Machine_Overflows is True |
| 516 |
|
| 517 |
-- WARNING: There is a matching C declaration of this variable in fe.h |
| 518 |
|
| 519 |
Signed_Zeros_On_Target : Boolean := True; |
| 520 |
-- Set to False on targets that do not reliably support signed zeros |
| 521 |
|
| 522 |
-- WARNING: There is a matching C declaration of this variable in fe.h |
| 523 |
|
| 524 |
----------------- |
| 525 |
-- Subprograms -- |
| 526 |
----------------- |
| 527 |
|
| 528 |
-- These subprograms are used to initialize the target parameter values |
| 529 |
-- from the system.ads file. Note that this is only done once, so if more |
| 530 |
-- than one call is made to either routine, the second and subsequent |
| 531 |
-- calls are ignored. It also reads restriction pragmas from system.ads |
| 532 |
-- and records them, though as further detailed below, the caller has some |
| 533 |
-- control over the handling of No_Dependence restrictions. |
| 534 |
|
| 535 |
type Make_Id_Type is access function (Str : Text_Buffer) return Node_Id; |
| 536 |
-- Parameter type for Get_Target_Parameters for function that creates an |
| 537 |
-- identifier node with Sloc value System_Location and given string as the |
| 538 |
-- Chars value. |
| 539 |
|
| 540 |
type Make_SC_Type is access function (Pre, Sel : Node_Id) return Node_Id; |
| 541 |
-- Parameter type for Get_Target_Parameters for function that creates a |
| 542 |
-- selected component with Sloc value System_Location and given Prefix |
| 543 |
-- (Pre) and Selector (Sel) values. |
| 544 |
|
| 545 |
type Set_NOD_Type is access procedure (Unit : Node_Id); |
| 546 |
-- Parameter type for Get_Target_Parameters that records a Restriction |
| 547 |
-- No_Dependence for the given unit (identifier or selected component). |
| 548 |
|
| 549 |
type Set_NSA_Type is access procedure (Asp : Name_Id; OK : out Boolean); |
| 550 |
-- Parameter type for Get_Target_Parameters that records a Restriction |
| 551 |
-- No_Specification_Of_Aspect. Asp is the aspect name. OK is set True |
| 552 |
-- if this is an OK aspect name, and False if it is not an aspect name. |
| 553 |
|
| 554 |
type Set_NUA_Type is access procedure (Attr : Name_Id; OK : out Boolean); |
| 555 |
-- Parameter type for Get_Target_Parameters that records a Restriction |
| 556 |
-- No_Use_Of_Attribute. Attr is the attribute name. OK is set True if |
| 557 |
-- this is an OK attribute name, and False if it is not an attribute name. |
| 558 |
|
| 559 |
type Set_NUP_Type is access procedure (Prag : Name_Id; OK : out Boolean); |
| 560 |
-- Parameter type for Get_Target_Parameters that records a Restriction |
| 561 |
-- No_Use_Of_Pragma. Prag is the pragma name. OK is set True if this is |
| 562 |
-- an OK pragma name, and False if it is not a recognized pragma name. |
| 563 |
|
| 564 |
procedure Get_Target_Parameters |
| 565 |
(System_Text : Source_Buffer_Ptr; |
| 566 |
Source_First : Source_Ptr; |
| 567 |
Source_Last : Source_Ptr; |
| 568 |
Make_Id : Make_Id_Type := null; |
| 569 |
Make_SC : Make_SC_Type := null; |
| 570 |
Set_NOD : Set_NOD_Type := null; |
| 571 |
Set_NSA : Set_NSA_Type := null; |
| 572 |
Set_NUA : Set_NUA_Type := null; |
| 573 |
Set_NUP : Set_NUP_Type := null); |
| 574 |
-- Called at the start of execution to obtain target parameters from the |
| 575 |
-- source of package System. The parameters provide the source text to be |
| 576 |
-- scanned (in System_Text (Source_First .. Source_Last)). If the three |
| 577 |
-- subprograms Make_Id, Make_SC, and Set_NOD are left at their default |
| 578 |
-- value of null, Get_Target_Parameters will ignore pragma Restrictions |
| 579 |
-- (No_Dependence) lines; otherwise it will use these three subprograms to |
| 580 |
-- record them. Similarly, if Set_NUP is left at its default value of null, |
| 581 |
-- then any occurrences of pragma Restrictions (No_Use_Of_Pragma => XXX) |
| 582 |
-- will be ignored; otherwise it will use this procedure to record the |
| 583 |
-- pragma. Similarly for the NSA and NUA cases. |
| 584 |
|
| 585 |
procedure Get_Target_Parameters |
| 586 |
(Make_Id : Make_Id_Type := null; |
| 587 |
Make_SC : Make_SC_Type := null; |
| 588 |
Set_NOD : Set_NOD_Type := null; |
| 589 |
Set_NSA : Set_NSA_Type := null; |
| 590 |
Set_NUA : Set_NUA_Type := null; |
| 591 |
Set_NUP : Set_NUP_Type := null); |
| 592 |
-- This version reads in system.ads using Osint. The idea is that the |
| 593 |
-- caller uses the first version if they have to read system.ads anyway |
| 594 |
-- (e.g. the compiler) and uses this simpler interface if system.ads is |
| 595 |
-- not otherwise needed. |
| 596 |
|
| 597 |
end Targparm; |