binopt(1)binopt(1)NAMEbinopt - Oracle Solaris Binary Optimizer
SYNOPSISbinopt [-binstrument[=on|off]]
[-bdata=datafile] [-bmt[=on|off]]
[-o filename] [-V] [-flags] [-Q[y|n]]
[-xinline=[[,v...]]] binfile
binopt [-buse[=on|off]] [-blevel=0|1|2]
[-bdata=datafile] [-bfinal[=on|off]] [-o filename]
[-V] [-flags] [-Q[y|n]]
[-xinline=[[,v...]]] binfile
DESCRIPTION
The binopt command is used to optimize (SPARC and x86/x64) Oracle
Solaris binaries (executables or shared objects). It can optimize bina‐
ries irrespective of the source language used. It can also optimize
mixed source language binaries. To be able to effectively optimize,
binaries must be built with some explicit level of optimization (-xOn)
and on a newer Solaris 10 system with patch 127111-07 installed.
The Binary Optimizer may also be used to instrument a binary for pro‐
file collection. The instrumented binary must then be run with an input
data training set representing a typical user's data. This training run
will create a binary file with profile data. This file must then be fed
back to the Binary Optimizer to create a profile optimized binary.
The binopt command performs several levels of optimizations. At higher
levels of optimization, more optimizations are performed, leading to a
potentially more optimal binary. A possible side-effect is increased
build time.
By default, if no output file name is specified, the input file is
overwritten with the optimized binary. Unless the -bfinal option is
given, binaries created by the binopt command may be optimized by a
future invocation of the Binary Optimizer.
The Binary Optimizer instruments an application binary assuming single
threaded execution. If the application starts threads, use -bmt=on to
enable thread safe profile counting.
binopt is available only on Oracle Solaris platforms.
binopt should not be used to instrument a binary that was compiled with
the -xpg flag for gprof profiling. binopt and gprof are incompatible.
OPTIONS
-binstrument[=on|off]
Instrument the binary for profile collection. All optimizations
are automatically turned off. The -bdata option may be used to
modify the default file used to store the profile data. This
cannot be used with the -buse flag.
-buse[=on|off]
Perform profile guided optimizations using profile data. Again,
the -bdata flag may be used to modify the default file location.
This cannot be used with the -binstrument flag.
-blevel=0|1|2
Perform different levels of optimizations.
At level 0, no optimizations are performed.
At level 1, do code reordering optimizations (this is the
default behavior).
At level 2, data-flow information is constructed and more
aggressive optimizations like inlining and address related opti‐
mizations are performed.
-bdata=datafile
Specifies the file where the profile data will be stored. This
option is used only with -binstrument or -buse and is ignored
otherwise. If this option is not used, the default file name is
binfile.instrdata.
-bfinal[=on|off]
Finalize the output binary so that no future binary optimiza‐
tions may be performed. This option is useful in the final
build step after which no further transformations are planned.
For example, this may be used with the -buse option when gener‐
ating the final optimal binary. The default is -bfinal=off.
-bmt[=on|off]
Enable thread safe profile counting.
Use with -binstrument if the executable starts threads. If the
executable is instrumented without -bmt=on and starts threads at
runtime, the instrumentation will terminate the application with
a message. The default is -bmt=on.
Example:
% binopt-binstrument -bmt=on binfile -o binoutfile
-o filename
Names the output file filename, instead of overwriting the input
binfile file by default.
-V Print the version number of the tool on the standard error out‐
put.
-flags Prints a one-line summary of available options.
-Q[y|n]
Emits or does not emit the Binary Optimizer version identifica‐
tion information the output file. If -Qy is used, identification
information will be added to the output files (the default
behavior). -Qn suppresses this information.
-xinline=[[,v...]]
v can be %auto func_name no%func_name
-xinline tries to inline only those functions specified in the
list. The list is comprised of either a comma-separated list of
function names, or a comma-separated list of no%func_name val‐
ues, or the value %auto. If you specify %nofunc_name, the com‐
piler is not to inline the named function. If you specify %auto,
binopt will attempt to automatically inline functions.
By default automatic inlining is enabled at optimization level
2.
OPERAND
binfile
Binary file to be optimized.
EXAMPLES
Example 1: Prepare and optimize a binary
The following entry prepares the created binary for optimizations and
then optimizes it with the binopt command, overwriting the binary file
in place.
% cc -O -xbinopt=prepare *.c -o a.out
% binopt a.out
Example 2: Instrument, run, and perform profile guided optimizations.
The following example instruments a binary, performs a training run and
then uses the profile data to perform profile guided optimizations.
% binopt-binstrument -bdata=a.out.data -o a.out.instr a.out
% ./a.out.instr
% binopt-buse -bdata=a.out.data -o a.out.opt a.out
Example 3: Perform level 2 optimizations and finalize.
The following example performs binary optimizations at level 2 and then
finalizes the binary so that the binary may not be optimized in the
future.
% binopt -blevel=2 -bfinal a.out
SEE ALSOcc(1), CC(1), f95(1).
June 2011 binopt(1)