mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-04-18 18:50:23 +08:00
doc: document long-standing restrictions in the use of $ in Dx
$ in data expressions is hazardous. A proper fix for this turns out to be quite complex, as it requires the expression engine to propagate additional data. For now, just put it into the documentation. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
parent
8806c3ca00
commit
235a115130
@ -34,11 +34,8 @@ operation size (e.g. \c{movsd qword [eax],xmm0}).
|
||||
\b The \c{-L+} option no longer enables \c{-Lw}, which is mainly
|
||||
useful to debug NASM crashes. See \k{opt-L}.
|
||||
|
||||
\b Fix the \c{__float80e__} and \c{__float128h__} conversions, which
|
||||
would return the wrong bytes of the result.
|
||||
|
||||
\b Fix inefficient encoding of the \c{BNDMK}, \c{BNDLDX}, and
|
||||
\c{BNDSTX} instructions under certain circumstances.
|
||||
\b Document long-standing hazards in the use of \c{$} in \c{Dx}
|
||||
statements, see \k{db}.
|
||||
|
||||
\S{cl-2.15.03} Version 2.15.03
|
||||
|
||||
|
@ -1259,12 +1259,16 @@ uninitialized}\i{uninitialized} counterparts \i\c{RESB}, \i\c{RESW},
|
||||
\i\c\{RESZ}; the \i\c{INCBIN} command, the \i\c{EQU} command, and the
|
||||
\i\c{TIMES} prefix.
|
||||
|
||||
In this documentation, the notation "\c{Dx}" and "\c{RESx}" is used to
|
||||
indicate all the \c{DB} and \c{RESB} type directives, respectively.
|
||||
|
||||
\S{db} \c{DB} and Friends: Declaring Initialized Data
|
||||
|
||||
\S{db} \c{Dx}: Declaring Initialized Data
|
||||
|
||||
\i\c{DB}, \i\c{DW}, \i\c{DD}, \i\c{DQ}, \i\c{DT}, \i\c{DO}, \i\c{DY}
|
||||
and \i\c{DZ} are used, much as in MASM, to declare initialized data in
|
||||
the output file. They can be invoked in a wide range of ways:
|
||||
and \i\c{DZ} (collectively "\c{Dx}" in this documentation) are used,
|
||||
much as in MASM, to declare initialized data in the output file. They
|
||||
can be invoked in a wide range of ways:
|
||||
\I{floating-point}\I{character constant}\I{string constant}
|
||||
|
||||
\c db 0x55 ; just the byte 0x55
|
||||
@ -1281,8 +1285,8 @@ the output file. They can be invoked in a wide range of ways:
|
||||
\c dq 1.234567e20 ; double-precision float
|
||||
\c dt 1.234567e20 ; extended-precision float
|
||||
|
||||
\c{DT}, \c{DO}, \c{DY} and \c{DZ} do not accept \i{numeric constants}
|
||||
as operands.
|
||||
\c{DT}, \c{DO}, \c{DY} and \c{DZ} do not accept integer
|
||||
\i{numeric constants} as operands.
|
||||
|
||||
\I{masmdb} Starting in NASM 2.15, a the following \i{MASM}-like features
|
||||
have been implemented:
|
||||
@ -1328,6 +1332,22 @@ valid:
|
||||
\c dd 16 dup (0xaaaa, ?, 0xbbbbbb)
|
||||
\c dd 64 dup (?)
|
||||
|
||||
\I{baddb} The use of \c{$} (current address) in a \c{Dx} statement is
|
||||
undefined in the current version of NASM, \e{except in the following
|
||||
cases}:
|
||||
|
||||
\b For the first expression in the statement, either a \c{DUP} or a data
|
||||
item.
|
||||
|
||||
\b An expression of the form "\e{value}\c{ - $}", which is converted
|
||||
to a self-relative relocation.
|
||||
|
||||
Future versions of NASM is likely to produce a different result or
|
||||
issue an error this case.
|
||||
|
||||
There is no such restriction on using \c{$$} or section-relative
|
||||
symbols.
|
||||
|
||||
\S{resb} \c{RESB} and Friends: Declaring \i{Uninitialized} Data
|
||||
|
||||
\i\c{RESB}, \i\c{RESW}, \i\c{RESD}, \i\c{RESQ}, \i\c{REST},
|
||||
|
Loading…
x
Reference in New Issue
Block a user