Compiler Output

The compiler can write compiled code in a relocatable object ￿le, generate a source code listing, and generate an error list. Unless y ou specify di￿eren tly, the compiler writes the object ￿le to the standard ￿le $NEWPASS , which is renamed $OLDPASS when the compile is completed and $NEWPASS is closed. The compiler writes the source code and error list to $STDLIST .

Compiler Operation

The compiler reads a source ￿le as input, performs a translation to object code, and writes the resulting compiled code in relocatable object modules. The n umber of modules in a ￿le is compiler dependent. MPE/iX compilers usually produce one relocatable object module in a relocatable object ￿le. The in ternal structure of a relocatable object module is common to all compilers that generate Hewlett-P ackard Precision Architecture (HP-PA) code. A relocatable object module con tains a combination of code and data for all procedures in the source

￿le that was the compilation unit. A relocatable object module is the smallest unit that a compiler can produce or the Link Editor can manipulate.

A source ￿le with sev eral procedures in it compiles all of them in to one relocatable object module. The procedures within the relocatable object module cannot be replaced or purged individually.

When a large program is divided in to several source ￿les, eac h one can refer to external procedures (subroutines or v ariables that are de￿ned in another ￿le). Because MPE/iX compilers process only one source ￿le at a time, external procedure references cannot be resolved at compile time. They are resolv ed at link time, when all of the program componen ts are brought together. The compiler simply assigns a ￿x-up request (frequen tly called a relocatable address) to eac h external reference, indicating the relativ e position of eac h subroutine or variable in the relocatable object module.

Note

A relocatable object module on MPE/iX corresponds to a relocatable binary

 

module (RBM) on MPE V/E, with the follo wing exceptions:

 

 

A relocatable object module can con tain zero, one, or sev eral procedures,

 

 

 

 

 

 

while an RBM represen ts only one.

 

 

A relocatable object module is complete in itself and can stand alone as an

 

 

 

 

 

 

independent ￿le, while an RBM can exist only as part of an MPE V/E user

 

 

subprogram library (USL) or a relocatable library (RL).

 

 

 

To separate relocatable object modules for t wo procedures into di￿erent relocatable object

￿les, you must put the procedures in separate source ￿les and compile them individually . You can gather them together at link time. Figure 3-2 sho ws an MPE/iX Nativ e Mode compiler producing a relocatable object module.

3-4 Program Development