Note that the level parameter is only used when the compiler is linking.
In the example above, the postoptimization level used is 2 even though the
object binaries were compiled with an implied level of 1.

The link-time post-optimizer cannot be used with the incremental linker, ild. The -xlinkopt flag will set the default
linker to be ld. Enabling the incremental linker explicitly
withthe -xildon flag will disable the -xlinkopt option if both are specified together.

For the -xlinkopt option to be useful, at least
some, but not necessarily all, of the routines in the program must be compiled
with this option. The optimizer can still perform some limited optimizations
on object binaries not compiled with -xlinkopt.

The -xlinkopt option will optimize code coming
from static libraries that appear on the compiler command line, but it will
skip and not optimize code coming from shared (dynamic) libraries that appear
on the command line. You can also use -xlinkopt when
building shared libraries (compiling with -G ).

The link-time post-optimizer is most effective when used with run-time
profile feedback. Profiling reveals the most and least used parts of the code
and directs the optimizer to focus its effort accordingly. This is particularly
important with large applications where optimal placement of code performed
at link time can reduce instruction cache misses. Typically, this would be
compiled as shown below:

Note that compiling with this option will increase link time slightly.
Object file sizes also increase, but the size of the executable remains the
same. Compiling with the -xlinkopt and -g flags
increases the size of the excutable by including debugging information.