Switches for gnatbind (GNAT User’s Guide for Native Platforms)

#### 4.5.2 Switches for `gnatbind` ¶

The following switches are available with `gnatbind`; details will be presented in subsequent sections.

`--version`

  Display Copyright and version, then exit disregarding all other options.

`--help`

  If `--version` was not used, display usage, then exit disregarding all other options.

`-a`

  Indicates that, if supported by the platform, the adainit procedure should be treated as an initialisation routine by the linker (a constructor). This is intended to be used by the Project Manager to automatically initialize shared Stand-Alone Libraries.

`-aO`

  Specify directory to be searched for ALI files.

`-aI`

  Specify directory to be searched for source file.

`-A[=`filename']`

  Output ALI list (to standard output or to the named file).

`-b`

  Generate brief messages to `stderr` even if verbose mode set.

`-c`

  Check only, no generation of binder output file.

`-d`nn'[k|m]`

  This switch can be used to change the default task stack size value to a specified size `nn`, which is expressed in bytes by default, or in kilobytes when suffixed with `k` or in megabytes when suffixed with `m`. In the absence of a `[k|m]` suffix, this switch is equivalent, in effect, to completing all task specs with

      pragma Storage_Size (nn);

  When they do not already have such a pragma.

`-D`nn'[k|m]`

  Set the default secondary stack size to `nn`. The suffix indicates whether the size is in bytes (no suffix), kilobytes (`k` suffix) or megabytes (`m` suffix).

  The secondary stack holds objects of unconstrained types that are returned by functions, for example unconstrained Strings. The size of the secondary stack can be dynamic or fixed depending on the target.

  For most targets, the secondary stack grows on demand and is implemented as a chain of blocks in the heap. In this case, the default secondary stack size determines the initial size of the secondary stack for each task and the smallest amount the secondary stack can grow by.

  For Light, Light-Tasking, and Embedded run-times the size of the secondary stack is fixed. This switch can be used to change the default size of these stacks. The default secondary stack size can be overridden on a per-task basis if individual tasks have different secondary stack requirements. This is achieved through the Secondary_Stack_Size aspect, which takes the size of the secondary stack in bytes.

`-e`

  Output complete list of elaboration-order dependencies.

`-Ea`

  Store tracebacks in exception occurrences when the target supports it. The “a” is for “address”; tracebacks will contain hexadecimal addresses, unless symbolic tracebacks are enabled.

  See also the packages `GNAT.Traceback` and `GNAT.Traceback.Symbolic` for more information. Note that on x86 ports, you must not use `-fomit-frame-pointer` `gcc` option.

`-Es`

  Store tracebacks in exception occurrences when the target supports it. The “s” is for “symbolic”; symbolic tracebacks are enabled.

`-E`

  Currently the same as `-Ea`.

`-f`elab-order'`

  Force elaboration order. For further details see Elaboration Control and Elaboration Order Handling in GNAT.

`-F`

  Force the checks of elaboration flags. `gnatbind` does not normally generate checks of elaboration flags for the main executable, except when a Stand-Alone Library is used. However, there are cases when this cannot be detected by gnatbind. An example is importing an interface of a Stand-Alone Library through a pragma Import and only specifying through a linker switch this Stand-Alone Library. This switch is used to guarantee that elaboration flag checks are generated.

`-h`

  Output usage (help) information.

`-H`

  Legacy elaboration order model enabled. For further details see Elaboration Order Handling in GNAT.

`-H32`

  Use 32-bit allocations for `__gnat_malloc` (and thus for access types). For further details see Dynamic Allocation Control.

`-H64`

  Use 64-bit allocations for `__gnat_malloc` (and thus for access types). For further details see Dynamic Allocation Control.

`-I`

  Specify directory to be searched for source and ALI files.

`-I-`

  Do not look for sources in the current directory where `gnatbind` was invoked, and do not look for ALI files in the directory containing the ALI file named in the `gnatbind` command line.

`-k`

  Disable checking of elaboration flags. When using `-n` either explicitly or implicitly, `-F` is also implied, unless `-k` is used. This switch should be used with care and you should ensure manually that elaboration routines are not called twice unintentionally.

`-K`

  Give list of linker options specified for link.

`-l`

  Output chosen elaboration order.

`-L`xxx'`

  Bind the units for library building. In this case the `adainit` and `adafinal` procedures (Binding with Non-Ada Main Programs) are renamed to `xxxinit` and `xxxfinal`. Implies -n. (GNAT and Libraries, for more details.)

`-M`xyz'`

  Rename generated main program from main to xyz. This option is supported on cross environments only.

`-m`n'`

  Limit number of detected errors or warnings to `n`, where `n` is in the range 1..999999. The default value if no switch is given is 9999. If the number of warnings reaches this limit, then a message is output and further warnings are suppressed, the bind continues in this case. If the number of errors reaches this limit, then a message is output and the bind is abandoned. A value of zero means that no limit is enforced. The equal sign is optional.

`-minimal`

  Generate a binder file suitable for space-constrained applications. When active, binder-generated objects not required for program operation are no longer generated. ‘Warning:’ this option comes with the following limitations:

  - Starting the program’s execution in the debugger will cause it to stop at the start of the `main` function instead of the main subprogram. This can be worked around by manually inserting a breakpoint on that subprogram and resuming the program’s execution until reaching that breakpoint.
  - Programs using GNAT.Compiler_Version will not link.
`-n`

  No main program.

`-nostdinc`

  Do not look for sources in the system default directory.

`-nostdlib`

  Do not look for library files in the system default directory.

`--RTS=`rts-path'`

  Specifies the default location of the run-time library. Same meaning as the equivalent `gnatmake` flag (Switches for gnatmake).

`-o `file'`

  Name the output file `file` (default is `b~`xxx'.adb`). Note that if this option is used, then linking must be done manually, gnatlink cannot be used.

`-O[=`filename']`

  Output object list (to standard output or to the named file).

`-p`

  Pessimistic (worst-case) elaboration order.

`-P`

  Generate binder file suitable for CodePeer.

`-Q`nnn'`

  Generate `nnn` additional default-sized secondary stacks.

  Tasks declared at the library level that use default-size secondary stacks have their secondary stacks allocated from a pool of stacks generated by gnatbind. This allows the default secondary stack size to be quickly changed by rebinding the application.

  While the binder sizes this pool to match the number of such tasks defined in the application, the pool size may need to be increased with the `-Q` switch to accommodate foreign threads registered with the Light run-time. For more information, please see the ‘The Primary and Secondary Stack’ chapter in the ‘GNAT User’s Guide Supplement for Cross Platforms’.

`-R`

  Output closure source list, which includes all non-run-time units that are included in the bind.

`-Ra`

  Like `-R` but the list includes run-time units.

`-s`

  Require all source files to be present.

`-S`xxx'`

  Specifies the value to be used when detecting uninitialized scalar objects with pragma Initialize_Scalars. The `xxx` string specified with the switch is one of:

  - `in` for an invalid value.

    If zero is invalid for the discrete type in question, then the scalar value is set to all zero bits. For signed discrete types, the largest possible negative value of the underlying scalar is set (i.e. a one bit followed by all zero bits). For unsigned discrete types, the underlying scalar value is set to all one bits. For floating-point types, a NaN value is set (see body of package System.Scalar_Values for exact values).

  - `lo` for low value.

    If zero is invalid for the discrete type in question, then the scalar value is set to all zero bits. For signed discrete types, the largest possible negative value of the underlying scalar is set (i.e. a one bit followed by all zero bits). For unsigned discrete types, the underlying scalar value is set to all zero bits. For floating-point, a small value is set (see body of package System.Scalar_Values for exact values).

  - `hi` for high value.

    If zero is invalid for the discrete type in question, then the scalar value is set to all one bits. For signed discrete types, the largest possible positive value of the underlying scalar is set (i.e. a zero bit followed by all one bits). For unsigned discrete types, the underlying scalar value is set to all one bits. For floating-point, a large value is set (see body of package System.Scalar_Values for exact values).

  - `xx` for hex value (two hex digits).

    The underlying scalar is set to a value consisting of repeated bytes, whose value corresponds to the given value. For example if `BF` is given, then a 32-bit scalar value will be set to the bit pattern `16#BFBFBFBF#`.

  In addition, you can specify `-Sev` to indicate that the value is to be set at run time. In this case, the program will look for an environment variable of the form `GNAT_INIT_SCALARS=yy`, where `yy` is one of `in/lo/hi/xx` with the same meanings as above. If no environment variable is found, or if it does not have a valid value, then the default is `in` (invalid values).

`-static`

  Link against a static GNAT run-time.

`-shared`

  Link against a shared GNAT run-time when available.

`-t`

  Tolerate time stamp and other consistency errors.

`-T`n'`

  Set the time slice value to `n` milliseconds. If the system supports the specification of a specific time slice value, then the indicated value is used. If the system does not support specific time slice values, but does support some general notion of round-robin scheduling, then any nonzero value will activate round-robin scheduling.

  A value of zero is treated specially. It turns off time slicing, and in addition, indicates to the tasking run-time that the semantics should match as closely as possible the Annex D requirements of the Ada RM, and in particular sets the default scheduling policy to `FIFO_Within_Priorities`.

`-u`n'`

  Enable dynamic stack usage, with `n` results stored and displayed at program termination. A result is generated when a task terminates. Results that can’t be stored are displayed on the fly, at task termination. This option is currently not supported on Itanium platforms. (See Dynamic Stack Usage Analysis for details.)

`-v`

  Verbose mode. Write error messages, header, summary output to `stdout`.

`-V`key'=`value'`

  Store the given association of `key` to `value` in the bind environment. Values stored this way can be retrieved at run time using `GNAT.Bind_Environment`.

`-w`x'`

  Warning mode; `x` = s/e for suppress/treat as error.

`-Wx`e'`

  Override default wide character encoding for standard Text_IO files.

`-x`

  Exclude source files (check object consistency only).

`-xdr`

  Use the target-independent XDR protocol for stream oriented attributes instead of the default implementation which is based on direct binary representations and is therefore target-and endianness-dependent. However it does not support 128-bit integer types and the exception `Ada.IO_Exceptions.Device_Error` is raised if any attempt is made at streaming 128-bit integer types with it.

`-X`nnn'`

  Set default exit status value, normally 0 for POSIX compliance.

`-y`

  Enable leap seconds support in `Ada.Calendar` and its children.

`-z`

  No main subprogram.

You may obtain this listing of switches by running `gnatbind` with no arguments.