On the surface, it appears as though an HP-UX compiler generates
an a.out file
by itself. Actually, an HP-UX compiler is a driver
that calls other commands to create the a.out
file. The driver performs different tasks (or phases)
for different languages, but two phases are common to all languages:
Figure 2-2 “Looking "inside"
a Compiler ”
summarizes how a compiler driver works.
The C, C++, FORTRAN, and Pascal compilers provide the -v
(verbose) option
to display the phases a compiler is performing. Compiling main.c
and func.c with
the -v option
produced this output on a Series 700 workstation (\
at the end of a line indicates the line is continued to the next
line):
$ cc -Aa -v main.c func.c -lm cc: CCOPTS is not set. main.c: /opt/langtools/lbin/cpp.ansi main.c /var/tmp/ctmAAAa10102 \\ -D__hp9000s700 -D__hp9000s800 -D__hppa -D__hpux \\ -D__unix -D_PA_RISC1_1 cc: Entering Preprocessor. /opt/ansic/lbin/ccom /var/tmp/ctmAAAa10102 main.o -O0 -Aa \\ func.c: /opt/langtools/lbin/cpp.ansi func.c /var/tmp/ctmAAAa10102 \\ -D__hp9000s700 -D__hp9000s800 -D__hppa -D__hpux \\ -D__unix -D_PA_RISC1_1 cc: Entering Preprocessor. /opt/ansic/lbin/ccom /var/tmp/ctmAAAa10102 func.o -O0 -Aa cc: LPATH is /usr/lib/pa1.1:/usr/lib:/opt/langtools/lib: /usr/ccs/bin/ld /opt/langtools/lib/crt0.o -u main main.o func.o \\ -lm -lc cc: Entering Link editor.
|
This example shows that the cc
driver calls the C preprocessor (/opt/langtools/lbin/cpp.ansi)
for each source file, then calls the actual C compiler (/opt/ansic/lbin/ccom)
to create the object files. Finally, the driver calls the linker
(/usr/ccs/bin/ld)
on the object files created by the compiler (main.o
and func.o).