Allow the user to suppress the abbreviation of the output from TIMES
(and therefore ALIGN) and INCBIN.
Sync the documentation with the help text, too.
Fixes: https://github.com/netwide-assembler/nasm/issues/211
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-M* options in response files would hold on to a pointer to the new
value, but in response files that is not a persistent buffer. Make
sure to make a copy instead.
This uses the new nasm_str[dup]to() helpers.
(Note that calling nasm_free() on a NULL pointer is guaranteed safe.)
Reported-by: <BreakingBad6@github.com>
Fixes: https://github.com/netwide-assembler/nasm/issues/222
Fixes: CVE-2026-6068
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Document the fix of $-escaped symbols in directives. Tidy up the
source formatting (no output change) of one of the bullet points.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
It is fairly common to want to represent characters like
Ctrl-Z. Instead of having to use character codes, allow these to be
coded as `\^z` or `\^Z` instead.
`\^?` is DEL.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Allow limits to be queried via a %limit() preprocessor function and a
__?NASM_LIMITS?__ macro.
Reset limits at the top of each pass. Note that the pass number limits
are checked at the *end* of the pass, so a %pragma limit will be
properly honored anyway.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Add an %env() function for expanding environment variables as a more
flexible and robust alternative to %! (the variable name can be
computed without doing weird things like %tok(%strcat("%!",...)) and a
fallback value can be specified by the user.)
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
C2y adds \o for octal byte escapes, and allows \x, \o, or \u escape
sequences to be enclosed in braces to indicate their termination.
Add a \d sequence as a NASM extension to allow decimal bytes to be
specified.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
- Document the fix to the JMP/CALL immediate size.
- Keep the convention to use capitals for keywords and instructions.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Apparently NASM has been doing this in violation of the spec since
JMPE was first added. Hopefully fixing it won't cause new problems...
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Matching of branch instructions with prefixes and sizes is, to say the
least, tricky. Work through it, and add a new macro to help.
Fixes: https://github.com/netwide-assembler/nasm/issues/144
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
The o64, a64 and a16 prefixes are only possible in specific
modes. It is a lot easier to debug with a more sensible error message.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Make the spellings for the label-mangling options and pragmas
consistent, and implement the directive forms which were documented
but never implemented.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
"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: https://github.com/netwide-assembler/nasm/pull/61
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This is really just a shorthand for the --before option, but it is
really convenient for quickly writing multimode tests.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Although one can implement this "manually" in terms of %sel(), this
function is *really* useful for making multi-mode tests and allows for
better error checking.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
The GROUP directive can now be specified more than once for a group,
and the result is cumulative (the union of all specified groups.)
Signed-off-by: KO Myung-Hun <komh78@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Merge PRs 127, 126, 125, 124 and 91. Document some of the most relevant
changes.
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
Looks like there are enough critical changes to justify a release
without a bunch of new development. Let's just call the new
release 3.01 and avoid a bunch of excess dottage.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
- Document the [LIST] directive
- Add an option -LF to ignore the [LIST] directive
- Fix [LIST -] suppressing output on a following pass
- Minor other documentation fixes
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Convenience preprocessor functions that allows for efficient packing
of binary data in source code.
Move some functions that has previously been local but are more
generally useful into more accessible places.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
It is sometimes just too convenient to be able to convert between
strings and bytes at will. At one point I was considering making
something with the full power of the db (et al) directives, but that
is a much bigger change...
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Older versions of NASM would not try to match unknown %if directives
with a corresponding %endif, resulting in some very odd consequences
when it comes to trying to handle support for multiple NASM versions.
Document the problem.
Reported-by: E. C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
If an unknown preprocessor directive starting with %if or %elif is
encountered, assume it should be treated as a conditional directive
for the purpose of balancing %if...%endif.
This avoids some really ugly problems when dealing with code that is
intended to work across NASM versions that uses %if directives that
don't yet exist.
Reported-by: E. C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
The message-generating functions appear to get expanded when they
shouldn't, resulting in errors. Disable them for now and remove them
from the documentation.
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>