HP-UX HB v13.00 Ch-11 - Software Development

HP-UX Handbook Rev 13.00 Page 8 (of 101)
Chapter 11 Software Development
October 29, 2013
Compiling
The .i file is then passed to the compiler which translates the source code into machine code,
creates a table of contents and references and stores both in an object file. The table of contents
is called the symbol table and holds all symbol names that are:
defined in the object and can be referenced from other objects (exported symbols)
referenced in the object but not defined here (imported symbols)
preprocessed file:
object file:
declaration of function A
declaration of function B
definition of function A:
- calls to function B
exported symbols:
- A (code)
imported symbols:
- B (code)
machine code of function A
To stop the build process after the compilation phase, the option -c must be used. The object file
has the same name as the source file, but with the extension .o.
Compiling HelloWorld.c
cc is the frontend command of the C compiler. It would subsequently execute the preprocessor,
the compiler and the linker and remove intermediate files (.i and .o files).
At this point we only want to compile a source and keep the object file, so we use the -c option.
The option -v can be used to see the details of the build process. It is common to all HP compiler
frontends to switch on verbose mode:
On PA:
$ cc -c -v HelloWorld.c
cc: NLSPATH is
/opt/ansic/lib/nls/msg/%L/%N.cat:/opt/ansic/lib/nls/msg/C/%N.cat:
cc: CCOPTS is not set.
cc: INCLUDIR is INCLUDIR=/usr/include
/opt/langtools/lbin/cpp.ansi HelloWorld.c /var/tmp/ctmAAAa29882 -$ -
D__hp9000s700 -D__hp9000s800 -D__hppa -D__hpux -D__unix -D_XOPEN_UNIX -D_ILP32
-e -D_PA_RISC2_0 -D_HPUX_SOURCE -D__STDC_EXT__
cc: Entering Preprocessor.
/opt/ansic/lbin/ccom /var/tmp/ctmAAAa29882 HelloWorld.o -FHelloWorld.c -
ESconstlit -Oq00,al,ag,cn,Lm,sz,Ic,vo,lc,mf,Po,es,rs,sp,in,vc,pi,fa,pe,
Rr,Fl,pv,pa,nf,cp,lx,st,ap,Pg,ug,lu,lb,uj,dp,fs,bp,wp,Ex,mp,
rp,ap,dn,Sg,pt,kt,Em,pc,np! Ae
$
On IA: