0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-07-24 10:25:42 -04:00

Document the -O0 and -O1 behaviors.

Document the way the -O0 and -O1 options actually behave.  -O0, in
particular, is NASM 0.98 compatibility mode.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2008-09-30 16:24:47 -07:00
parent f1aefd8456
commit dc0bf47feb
2 changed files with 18 additions and 8 deletions

View File

@ -8,6 +8,12 @@ The NASM 2 series support x86-64, and is the production version of NASM
since 2007. since 2007.
\S{cl-2.05} Version 2.05
\b Make the behaviour of \c{-O0} match NASM 0.98 legacy behavior.
See \k{opt-O}.
\S{cl-2.04} Version 2.04 \S{cl-2.04} Version 2.04
\b Sanitize macro handing in the \c{%error} directive. \b Sanitize macro handing in the \c{%error} directive.

View File

@ -787,22 +787,26 @@ NASM defaults to not optimizing operands which can fit into a signed byte.
This means that if you want the shortest possible object code, This means that if you want the shortest possible object code,
you have to enable optimization. you have to enable optimization.
Using the \c{-O} option, you can tell NASM to carry out different levels of optimization. Using the \c{-O} option, you can tell NASM to carry out different
The syntax is: levels of optimization. The syntax is:
\b \c{-O0}: No optimization. All operands take their long forms, \b \c{-O0}: No optimization. All operands take their long forms,
if a short form is not specified. if a short form is not specified, except conditional jumps.
This is intended to match NASM 0.98 behavior.
\b \c{-O1}: Minimal optimization. As above, but immediate operands \b \c{-O1}: Minimal optimization. As above, but immediate operands
which will fit in a signed byte are optimized, which will fit in a signed byte are optimized,
unless the long form is specified. unless the long form is specified. Conditional jumps default
to the long form unless otherwise specified.
\b \c{-Ox} (where \c{x} is the actual letter \c{x}): Multipass optimization. \b \c{-Ox} (where \c{x} is the actual letter \c{x}): Multipass optimization.
Minimize branch offsets and signed immediate bytes, Minimize branch offsets and signed immediate bytes,
overriding size specification unless the \c{strict} keyword overriding size specification unless the \c{strict} keyword
has been used (see \k{strict}). For compatability with earlier has been used (see \k{strict}). For compatability with earlier
releases, the letter \c{x} may also be any number greater than releases, the letter \c{x} may also be any number greater than
one. This number has no effect on the actual number of passes. one. This number has no effect on the actual number of passes.
The \c{-Ox} mode is recommended for most uses.
Note that this is a capital \c{O}, and is different from a small \c{o}, which Note that this is a capital \c{O}, and is different from a small \c{o}, which
is used to specify the output file name. See \k{opt-o}. is used to specify the output file name. See \k{opt-o}.