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


7.2.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 GNAT Reference Manual for more information about this pragma.

gnatelim needs as its input data the name of the main subprogram and a bind file for a main subprogram.

To create a bind file for gnatelim, run gnatbind for the main subprogram. gnatelim can work with both Ada and C bind files; when both are present, it uses the Ada bind file. The following commands will build the program and create the bind file:

     $ gnatmake -c Main_Prog
     $ gnatbind main_prog

Note that gnatelim needs neither object nor ALI files.