aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-14 13:02:39 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-14 13:02:39 -0800
commit1e2358b17f69c713ca0567bd892e2b8cadeb3a22 (patch)
tree9355946d98705297bf0d21fc8b70488c67eb6c77
parent0402a2d40233acdae005b8cad33d502f95da63df (diff)
downloadnasm-1e2358b17f69c713ca0567bd892e2b8cadeb3a22.tar.gz
nasm-1e2358b17f69c713ca0567bd892e2b8cadeb3a22.tar.xz
nasm-1e2358b17f69c713ca0567bd892e2b8cadeb3a22.zip
Document the -Ov option, minor fix for gcc -Og
The -Ov option is useful but was undocumented. Add an initialization to keep gcc from complaining at optimization level -Og. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--asm/nasm.c4
-rw-r--r--doc/nasmdoc.src7
2 files changed, 9 insertions, 2 deletions
diff --git a/asm/nasm.c b/asm/nasm.c
index c6e82eaf..1c5a5fc5 100644
--- a/asm/nasm.c
+++ b/asm/nasm.c
@@ -1135,6 +1135,7 @@ static bool process_arg(char *p, char *q, int pass)
break;
}
+ olen = 0; /* Placate gcc at lower optimization levels */
plen = strlen(p);
for (tx = textopts; tx->label; tx++) {
olen = strlen(tx->label);
@@ -1985,10 +1986,11 @@ static void help(const char xopt)
" -l listfile write listing to a listfile\n\n"
" -Ipath add a pathname to the include file path\n");
printf
- (" -Olevel optimize opcodes, immediates and branch offsets\n"
+ (" -Oflags... optimize opcodes, immediates and branch offsets\n"
" -O0 no optimization\n"
" -O1 minimal optimization\n"
" -Ox multipass optimization (default)\n"
+ " -Ov display the number of passes executed at the end\n"
" -Pfile pre-include a file (also --include)\n"
" -Dmacro[=str] pre-define a macro\n"
" -Umacro undefine a macro\n"
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index bdec6b6e..ea6f10f2 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -746,7 +746,9 @@ with a \i{stub preprocessor} which does nothing.
\S{opt-O} The \i\c{-O} Option: Specifying \i{Multipass Optimization}
Using the \c{-O} option, you can tell NASM to carry out different
-levels of optimization. The syntax is:
+levels of optimization. Multiple flags can be specified after the
+\c{-O} options, some of which can be combined in a single option,
+e.g. \c{-Oxv}.
\b \c{-O0}: No optimization. All operands take their long forms,
if a short form is not specified, except conditional jumps.
@@ -764,6 +766,9 @@ levels of optimization. The syntax is:
releases, the letter \c{x} may also be any number greater than
one. This number has no effect on the actual number of passes.
+\b \c{-Ov}: At the end of assembly, print the number of passes
+ actually executed.
+
The \c{-Ox} mode is recommended for most uses, and is the default
since NASM 2.09.