Skip to content

Commit 0a1a978

Browse files
author
H. Peter Anvin (Intel)
committed
Fix confusion between "postfix" and "suffix"
"suffix" is the more common English term, but NASM used "postfix" for a long time. Allow them as aliases, and tidy up the documentation accordingly. While making these changes, tidy up the handling of options in the index. Fixes: #61 Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
1 parent 89439aa commit 0a1a978

File tree

5 files changed

+59
-23
lines changed

5 files changed

+59
-23
lines changed

asm/nasm.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -934,10 +934,13 @@ static const struct textargs textopts[] = {
934934
{"abort-on-panic", OPT_ABORT_ON_PANIC, ARG_NO, 0},
935935
{"prefix", OPT_MANGLE, ARG_YES, LM_GPREFIX},
936936
{"postfix", OPT_MANGLE, ARG_YES, LM_GSUFFIX},
937+
{"suffix", OPT_MANGLE, ARG_YES, LM_GSUFFIX},
937938
{"gprefix", OPT_MANGLE, ARG_YES, LM_GPREFIX},
938939
{"gpostfix", OPT_MANGLE, ARG_YES, LM_GSUFFIX},
940+
{"gsuffix", OPT_MANGLE, ARG_YES, LM_GSUFFIX},
939941
{"lprefix", OPT_MANGLE, ARG_YES, LM_LPREFIX},
940942
{"lpostfix", OPT_MANGLE, ARG_YES, LM_LSUFFIX},
943+
{"lsuffix", OPT_MANGLE, ARG_YES, LM_LSUFFIX},
941944
{"include", OPT_INCLUDE, ARG_YES, 0},
942945
{"pragma", OPT_PRAGMA, ARG_YES, 0},
943946
{"before", OPT_BEFORE, ARG_YES, 0},
@@ -2477,10 +2480,10 @@ static void help(FILE *out, const char *what)
24772480
" --before str add line (usually a preprocessor statement) before the input\n"
24782481
" --bits nn set bits to nn (equivalent to --before \"BITS nn\")\n"
24792482
" --no-line ignore %line directives in input\n"
2480-
" --prefix str prepend the given string to the names of all extern,\n"
2481-
" common and global symbols (also --gprefix)\n"
2482-
" --suffix str append the given string to the names of all extern,\n"
2483-
" common and global symbols (also --gprefix)\n"
2483+
" --gprefix str prepend the given string to the names of all extern,\n"
2484+
" common and global symbols (also --prefix)\n"
2485+
" --gpostfix str append the given string to the names of all extern,\n"
2486+
" common and global symbols (also --postfix)\n"
24842487
" --lprefix str prepend the given string to local symbols\n"
24852488
" --lpostfix str append the given string to local symbols\n"
24862489
" --reproducible attempt to produce run-to-run identical output\n"

doc/changes.src

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ It is the production version of NASM since 2025.
3434
\b A new \c{%selbits()} preprocessor function. See \k{f_selbits}.
3535

3636
\b A new \c{--bits} option as convenience shorthand for \c{--before
37-
"BITS ..."}. See \k{opt-bits}.
37+
"BITS ..."}. See \k{opt-bits}.
38+
39+
\b Add aliases \c{--suffix}, \c{--gsuffix} and \c{--lsuffix} for the
40+
corresponding \c{postfix} options. See \k{opt-pfix}.
3841

3942

4043
\S{cl-3.00} Version 3.00

doc/index.src

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
\IR{-p} \c{-p} option
2727
\IR{-s} \c{-s} option
2828
\IR{-u} \c{-u} option
29-
\IR{-v} \c{-v} option
3029
\IR{-W} \c{-W} option
30+
\IR{-t} \c{-t} option
31+
\IR{-soname} \c{-soname}, linker option
3132
\IR{-Werror} \c{-Werror} option
3233
\IR{-Wno-error} \c{-Wno-error} option
3334
\IR{-w} \c{-w} option

doc/ndisasm.src

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ instruction table (and some other bits of code) with NASM.
1414
The Netwide Disassembler does nothing except to produce
1515
disassemblies of \e{binary} source files. NDISASM does not have any
1616
understanding of object file formats, like \c{objdump}, and it will
17-
not understand \c{DOS .EXE} files like \c{debug} will. It just
17+
not understand DOS \c{.EXE} files like \c{debug} will. It just
1818
disassembles.
1919

2020

21-
\H{ndisrun} Running NDISASM
21+
\H{ndisrun} \I{options, disassembler}Running NDISASM
2222

2323
To disassemble a file, you will typically use a command of the form
2424

2525
\c ndisasm -b {16|32|64} filename
2626

2727
NDISASM can disassemble 16-, 32- or 64-bit code equally easily,
2828
provided of course that you remember to specify which it is to work
29-
with. If no \i\c{-b} switch is present, NDISASM works in 16-bit mode
30-
by default. The \i\c{-u} switch (for USE32) also invokes 32-bit mode.
29+
with. If no \c{-b} switch is present, NDISASM works in 16-bit mode
30+
by default. The \c{-u} switch (for USE32) also invokes 32-bit mode.
3131

32-
Two more command line options are \i\c{-r} which reports the version
33-
number of NDISASM you are running, and \i\c{-h} which gives a short
32+
Two more command line options are \c{-r} which reports the version
33+
number of NDISASM you are running, and \c{-h} which gives a short
3434
summary of command line options.
3535

3636

@@ -42,7 +42,7 @@ rather than at zero. NDISASM, which assumes by default that any file
4242
you give it is loaded at zero, will therefore need to be informed of
4343
this.
4444

45-
The \i\c{-o} option allows you to declare a different origin for the
45+
The \c{-o} option allows you to declare a different origin for the
4646
file you are disassembling. Its argument may be expressed in any of
4747
the NASM numeric formats: decimal by default, if it begins with `\c{$}'
4848
or `\c{0x}' or ends in `\c{H}' it's \c{hex}, if it ends in `\c{Q}' it's
@@ -84,7 +84,7 @@ instruction and output a `\c{db}' instead. So it \e{will} start
8484
disassembly exactly from the sync point, and so you \e{will} see all
8585
the instructions in your code section.
8686

87-
Sync points are specified using the \i\c{-s} option: they are measured
87+
Sync points are specified using the \c{-s} option: they are measured
8888
in terms of the program origin, not the file position. So if you
8989
want to synchronize after 32 bytes of a \c{.COM} file, you would have to
9090
do
@@ -116,7 +116,7 @@ be, surely, would be to read the \c{JMP} instruction, and then to use
116116
its target address as a sync point. So can NDISASM do that for you?
117117

118118
The answer, of course, is yes: using either of the synonymous
119-
switches \i\c{-a} (for automatic sync) or \i\c{-i} (for intelligent
119+
switches \c{-a} (for automatic sync) or \c{-i} (for intelligent
120120
sync) will enable \c{auto-sync} mode. Auto-sync mode automatically
121121
generates a sync point for any forward-referring PC-relative jump or
122122
call instruction that NDISASM encounters. (Since NDISASM is one-pass,
@@ -153,16 +153,14 @@ suppress disassembly of the data area.
153153

154154
\S{ndisother} Other Options
155155

156-
The \i\c{-e} option skips a header on the file, by ignoring the first N
156+
The \c{-e} option skips a header on the file, by ignoring the first N
157157
bytes. This means that the header is \e{not} counted towards the
158158
disassembly offset: if you give \c{-e10 -o10}, disassembly will start
159159
at byte 10 in the file, and this will be given offset 10, not 20.
160160

161-
The \i\c{-k} option is provided with two comma-separated numeric
161+
The \c{-k} option is provided with two comma-separated numeric
162162
arguments, the first of which is an assembly offset and the second
163163
is a number of bytes to skip. This \e{will} count the skipped bytes
164164
towards the assembly offset: its use is to suppress disassembly of a
165165
data section which wouldn't contain anything you wanted to see
166166
anyway.
167-
168-

doc/running.src

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ the \i\c{[WARNING]} directive. See \k{asmdir-warning}.
515515

516516
See \k{warnings} for the complete list of warning classes.
517517

518+
\IR{-v} \c{-v} option
519+
\IR{--v} \c{--v} option
520+
518521
\S{opt-v} The \i\c{-v} Option: Display \i{Version} Info
519522

520523
Typing \c{NASM -v} will display the version of NASM which you are using,
@@ -526,13 +529,22 @@ For command-line compatibility with Yasm, the form \i\c{--v} is also
526529
accepted for this option starting in NASM version 2.11.05.
527530

528531

529-
\S{opt-pfix} The \i\c{--(g|l)prefix}, \i\c{--(g|l)postfix} Options.
532+
\IR{--prefix} \c{--prefix} option
533+
\IC{--prefix}{--gprefix} \c{--gprefix} option
534+
\IC{--prefix}{--lprefix} \c{--lprefix} option
535+
\IC{--prefix}{--gpostfix} \c{--gpostfix} option
536+
\IC{--prefix}{--lpostfix} \c{--lpostfix} option
537+
\IC{--prefix}{--suffix} \c{--suffix} option
538+
\IC{--prefix}{--gsuffix} \c{--gsuffix} option
539+
\IC{--prefix}{--lsuffix} \c{--lsuffix} option
540+
541+
\S{opt-pfix} The \I{--prefix}\c{--[gl]prefix} and \c{--[gl]postfix} Options
530542

531543
The \c{--gprefix} option prepends the given argument
532544
to all \c{extern}, \c{common}, \c{static}, and \c{global} symbols, and the
533545
\c{--lprefix} option prepends to all other symbols. Similarly,
534546
\c{--gpostfix} and \c{--lpostfix} options append
535-
the argument, in a manner similar to the \c{--(g|l)prefix} options.
547+
the argument, in a manner similar to the \c{--[gl]prefix} options.
536548

537549
Running this:
538550

@@ -543,6 +555,15 @@ at the start of the file (\k{mangling}). It will prepend the underscore
543555
to all global and external variables, as C requires it in some, but not all,
544556
system calling conventions.
545557

558+
\c{--prefix} is an alias for \c{--gprefix}.
559+
560+
Starting with NASM 3.01, \c{--suffix}, \c{--gsuffix}, and
561+
\c{--lsuffix} are accepted as aliases for the corresponding
562+
\c{postfix} options.
563+
564+
565+
\IR{--pragma} \c{--pragma} option
566+
546567
\S{opt-pragma} The \i\c{--pragma} Option
547568

548569
NASM accepts an argument as \c{%pragma} option, which is like placing
@@ -554,6 +575,8 @@ Running this:
554575
is equivalent to the example in \k{opt-pfix}. See \k{pragma}.
555576

556577

578+
\IR{--before} \c{--before} option
579+
557580
\S{opt-before} The \i\c{--before} Option
558581

559582
Insert a statement (usually, but not necessarily) a preprocess
@@ -563,6 +586,8 @@ is the same as running this:
563586
\c nasm -f macho --before "%pragma macho gprefix _"
564587

565588

589+
\IR{--bits} \c{--bits} option
590+
566591
\S{opt-bits} The \i\c{--bits} Option
567592

568593
Set the processor mode by inserting a \c{BITS} directive (kee
@@ -575,10 +600,11 @@ exactly equivalent:
575600
The \c{--bits} option was introduced in NASM 3.01; the \c{--before}
576601
form can be used for compatibility with older versions of NASM.
577602

603+
\IR{--limit-} \c{--limit-} options
578604

579-
\S{opt-limit} The \i\c{--limit-X} Option
605+
\S{opt-limit} The \i\c{--limit-} Options
580606

581-
This option allows user to setup various maximum values after which
607+
These options allows user to setup various maximum values after which
582608
NASM will terminate with a fatal error rather than consume arbitrary
583609
amount of compute time. Each limit can be set to a positive number or
584610
\c{unlimited}.
@@ -616,18 +642,23 @@ example:
616642

617643
\c %pragma limit lines 1000
618644

645+
\IR{--keep-all} \c{--keep-all} option
619646

620647
\S{opt-keep-all} The \i\c{--keep-all} Option
621648

622649
This option prevents NASM from deleting any output files even if an
623650
error happens.
624651

652+
\IR{--no-line} \c{--no-line} option
653+
625654
\S{opt-no-line} The \i\c{--no-line} Option
626655

627656
If this option is given, all \i\c{%line} directives in the source code
628657
are ignored. This can be useful for debugging already preprocessed
629658
code. See \k{line}.
630659

660+
\IR{--reproducible} \c{--reproducible} option
661+
631662
\S{opt-reproducible} The \i\c{--reproducible} Option
632663

633664
If this option is given, NASM will not emit information that is

0 commit comments

Comments
 (0)