F.4.1 Compiling the RTL

To recompile the RTL, so a new compiler can be built, at least the following units must be built, in the order specified:

  1. The program stubs, that are the startup code for each pascal program. These files have the .as extension, because they are written in assembler. They must be assembled with the gnu as assembler. These stubs are in the OS-dependent directory, except for linux, where they are in a processor dependent subdirectory of the linux directory (i386 or m68k).
  2. The system unit. This unit resides in the OS-dependent subdirectories of the RTL.
  3. The strings unit. This unit resides in the inc subdirectory of the RTL.
  4. The dos unit. It resides in the OS-dependent subdirectory of the RTL. Possibly other units will be compiled as a consequence of trying to compile this unit (e.g. on linux, the linux unit will be compiled, on go32, the go32 unit will be compiled).
  5. The objects unit. It resides in the inc subdirectory of the RTL.

To compile these units on a i386, the following statements will do:

ppc386 -Tlinux -b- -Fi../inc -Fi../i386 -FE. -di386 -Us -Sg system.pp  
ppc386 -Tlinux -b- -Fi../inc -Fi../i386 -FE. -di386 ../inc/strings.pp  
ppc386 -Tlinux -b- -Fi../inc -Fi../i386 -FE. -di386 dos.pp  
ppc386 -Tlinux -b- -Fi../inc -Fi../i386 -FE. -di386 ../inc/objects.pp

These are the minimum command line options, needed to compile the RTL.

For another processor, the i386 should be changed into the appropriate processor. For another target OS, the target OS setting (-T) must be set accordingly.

Depending on the target OS there are other units that can be compiled, but which are not strictly needed to recompile the compiler. The following units are available for all plaforms:

objpas
Needed for Delphi mode. Needs -Mobjpas as an option. Resides in the objpas subdirectory.
sysutils
Many utility functions, like in Delphi. Resides in the objpas directory, and needs -MObjpas to compile.
typinfo
Functions to access RTTI information, like Delphi. Resides in the objpas directory.
math
Math functions like in Delphi. Resides in the objpas directory.
mmx
Extensions for MMX class Intel processors. Resides in in the i386 directory.
getopts
A GNU compatible getopts unit. Resides in the inc directory.
heaptrc
To debug the heap. Resides in the inc directory.