Some preprocessor functions have the same name as directives. In those
cases, they should be expanded as functions if and only if they are
followed by a left parenthesis. Although it is not inherently true that
either preprocessor functions require a paren nor that directives
cannot start with one, but it is true and will remain true for all
cases where there is a namespace collision.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
%substr contained a token skip to "skip expanded ID", which is
incorrect, as that has already been skipped at that point. It worked
anyway, accidentally, as this token would always be a whitespace token
-- but we then do skip_white() immediately thereafter.
Delete this to allow this code to be factored.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The use of statements like "chapter", "section" and so on makes the
HTML index insanely verbose. Remove them; they don't add any
information.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Allow a single index entry key to be defined with \IR more than once,
generating multiple entries in the index; this is really useful for
example to always generate "macros, single-line" and "single-line
macros" entries sorted at different places.
Be smarter about sorting the index: sort (nearly) all special
characters before alphanumerics, and (attempt to) sort numbers in
numerical order rather than alphabetical (so BITS8 sorts before
BITS16).
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The web site currently assumes that the release history is always in
appendix C. Humor it for now, besides, it doesn't really make sense
for the huge machine-generated instruction list to be anywhere but the
end.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
If a list of index entries is so long that the whole list can't fit
onto a single page, we *have* to break it. Treat the hanging-comma
line as a potential widow, but allow column breaks elsewhere in the
list.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
RDOFF has been deprecated as it has unfixable problems, and has been
announced that it will be killed off in NASM 2.16.
This deletes it once and for all.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit adds a check to see if the macro that we want to unmacro exists.
A previous commit, introduced a check to see if the unmacro was undefining a macro being expanded, but that same check included a null pointer dereference if the macro to undefine did not exist.
The following code reproduced the issue:
```asm
%macro baz 0
%unmacro F 0
%endmacro
baz
```
Compile with:
```shell
$ nasm -f elf64 -g -FDWARF -o tmp.o -werror file.asm
```
[hpa: adjusted code to match NASM style]
Fixes bug 3392761
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The FP16 patch had a case of bit overlap. Clean up the handling of
broadcast flags a little in the process.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This reverts commit 8fcc785f95.
This patch causes test a32offs.asm, and in general *any* use of the
"bits" macro, to totally fail.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
case PP_ENDM:
case PP_ENDMACRO:
if (!(defining && defining->name)) {
nasm_nonfatal("`%s': not defining a macro", tok_text(tline));
goto done;
}
mmhead = (MMacro **) hash_findi_add(&mmacros, defining->name);
defining->next = *mmhead;
*mmhead = defining;
defining = NULL;
break;
The variable: mmacros has not been released, which will cause a memory
leak. Repair cve-2021-33450 cve-2021-33452 synchronously
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Add support for AVX512-FP16 instructions and the associated
handling. Allow "mapN" syntax as well as "mN" syntax to match the
documentation.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
free() and nasm_free() are required to be compatible (as we may end up
having memory allocated on the heap by the C library), but that
doesn't mean we shouldn't use it whereever possible to allow for
better debugging.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392804
Reported-by: C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
An empty %{} becomes % which is simply the arithmetic
operator. Although that is consistent, it might be surprising for
users, to issue a warning.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
%[] amounts to an empty token; this needs to be handled specially so
that it gets properly dropped.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392806
Reported-by: C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
while (nbs--) { ... } ends with nbs == -1. Rather than a minimal fix,
introduce mempset() to make these kinds of errors less likely in the
future.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392815
Reported-by: <13579and24680@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
The VCVTNEPS2BF16 instruction was incorrectly specified as
VCVTNE2S2BF16. Fortunately, the correct opcode for the latter was
specified first, so it would emit the correct result when that
instruction was specified.
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392821
Reported-by: Agner <agner@agner.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
There are no use cases for of RELA on i386, and the intent has always been
that efmt->rel_size would be the size of the desired relocation
section type. Rename it from rel_size to relsize to make it more
obvious that it matches efmt->reltype rather than SHT_REL, and delete
efmt->rela_size to keep it from being misused again.
This should avoid a repeat of:
https://bugzilla.nasm.us/show_bug.cgi?id=3392807
fixed in adf7507e29.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
There is no documentation of the `%unimacro` directive.
This is particularly confusing when you’re trying to remove a macro
that has previously been defined with the `%imacro` directive.