If you do compile and link in separate steps, consistent compiling and linking is critical when using the following compiler options:
-B
-compat
–fast
-g
-g0
-library
-misalign
-mt
-p
-xa
-xarch
–xcg92 and -xcg89
-xipo
-xpagesize
-xpg
-xprofile
-xtarget
If you compile any subprogram using any of these options, be sure to link using the same option as well:
In the case of the -library, -fast, -xtarget, and -xarch options, you must be sure to include the linker options that would have been passed if you had compiled and linked together.
With -p, -xpg, and -xprofile, including the option in one phase and excluding it from the other phase will not affect the correctness of the program, but you will not be able to do profiling.
With -g and -g0, including the option in one phase and excluding it from the other phase will not affect the correctness of the program, but it will affect the ability to debug the program. Any module that is not compiled with either of these options, but is linked with -g or -g0 will not be prepared properly for debugging. Note that compiling the module that contains the function main with the -g option or the -g0 option is usually necessary for debugging.
In the following example, the programs are compiled using the -xcg92 compiler option. This option is a macro for -xtarget=ss1000 and expands to: -xarch=v8 -xchip=super -xcache=16/64/4:1024/64/1.
example% CC -c -xcg92 sbr.cc example% CC -c -xcg92 smain.cc example% CC -xcg92 sbr.o smain.o |
If the program uses templates, it is possible that some templates will get instantiated at link time. In that case the command line options from the last line (the link line) will be used to compile the instantiated templates.