Next: , Up: Reducing Size of Ada Executables with gnatelim

7.3.1 About gnatelim

When a program shares a set of Ada packages with other programs, it may happen that this program uses only a fraction of the subprograms defined in these packages. The code created for these unused subprograms increases the size of the executable.

gnatelim tracks unused subprograms in an Ada program and outputs a list of GNAT-specific pragmas Eliminate marking all the subprograms that are declared but never called. By placing the list of Eliminate pragmas in the GNAT configuration file gnat.adc and recompiling your program, you may decrease the size of its executable, because the compiler will not generate the code for 'eliminated' subprograms. See Pragma Eliminate, for more information about this pragma.

gnatelim needs as its input data the name of the main subprogram.

If a set of source files is specified as gnatelim arguments, it treats these files as a complete set of sources making up a program to analyse, and analyses only these sources.

After a full successful build of the main subprogram gnatelim can be called without specifying sources to analyse, in this case it computes the source closure of the main unit from the ALI files.

The following command will create the set of ALI files needed for gnatelim:

     $ gnatmake -c Main_Prog

Note that gnatelim does not need object files.