Chapter Contents |
Previous |
Next |
Prelinking C and C++ Programs |
The
cool
utility program is an object
code preprocessor that assists in the link-editing of C and C++ programs.
cool
merges initialization CSECTs for static and external variables;
the IBM linkage editor does not have this capability. When the
-Krent
or
-Krentext
compiler option is used to allow reentrant modification of
data, the compiler creates a separate CSECT to contain the external variable
initialization data for each compilation. Data to be used for the initialization
of external variables are read during program start-up and copied to dynamically
allocated memory. This copy process is necessary to support reentrant execution.
(If no external variables are initialized in a compilation, then the CSECT
is not created. When the
-Krent
option is used, this applies
to static as well as external variables.)
The
cool
utility merges this initialization
data by combining all of the object code for a given program in a manner similar
to the CMS loader or OS/390 linkage editor. If any of the object files contain
an initialization CSECT,
cool
retains the initialization data
and then deletes the CSECT from the object file. When all of the object files
are processed,
cool
produces a single object file containing one
copy of the initialization CSECT, followed by the preprocessed object files.
The
cool
utility also checks for external
variables with multiple initial values during the merge.
cool
issues a warning for external variables with multiple initial values.
When the use of extended
names is specified by the
-Kextname
compiler option,
cool
performs additional preprocessing. Under the
-Kextname
option, the compiler
creates special data objects in the object file that contains the original
C or C++ identifiers and their associated short forms. The
cool
utility reads these data objects and then creates unique external symbols
in the output object file, thus enabling the linkage editor or loader to properly
link the output object file by using these unique external symbols.
cool
more than once on
any object file that was previously compiled with the
-Kextname
option or prelinked with the
-p
option.
cool
requires that each
input object file have a unique section name.
cool
utility also resolves
external references with defining modules in
ar370
archives.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.