Commit graph

4458 commits

Author SHA1 Message Date
H. Peter Anvin (Intel)
57c375305c Makefile: add warnings.src to perlreq; longer list of binary files
Add warnings.src to PERLREQ.  If this isn't done, warnings.src ends up
in the xdoc tarball rather than the release tarball, which means that
unless the user can "make warnings" manually (which requires Perl)
then they can't build the documentation.

As this only affects the documentation build, it probably does not
warrant a point release.

Add a few more extensions to the list of recognized binary extensions
for the purpose of generating a .zip file with DOS line ending
conventions.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-27 16:04:38 -07:00
H. Peter Anvin (Intel)
a825b33423 NASM 2.15 2020-06-27 15:24:47 -07:00
H. Peter Anvin (Intel)
ea4c91bf32 NASM 2.15rc12 2020-06-26 16:20:27 -07:00
H. Peter Anvin (Intel)
29a61b7987 DWARF: consistent version information; drop .debug_loc section
Fix the version information for various sections and generalize their
implementation. Drop issuing an empty .debug_pubnames section; like
other sections DWARF parsers seem to be unhappy about a section with
null content.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-26 16:14:55 -07:00
H. Peter Anvin (Intel)
47d207d1a3 test: add Makefile target for elfx32
Add an .ox Makefile target for an ELFx32 object.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-26 16:14:31 -07:00
H. Peter Anvin (Intel)
eb571a3ac3 dwarf: don't emit a dummy .debug_loc section
It seems DWARF parsers get really snippy about a section which only
contains an end token. Instead, leave unused sections empty. Already
did that with .debug_frame, do it with .debug_loc too.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-26 15:22:26 -07:00
H. Peter Anvin (Intel)
241697306c BR 3392650: Codeview truncates symbol table length to 16 bits
If the source code is large, it is very reasonable for the symbol
table length to exceed 2^16 bits. Use uint32_t to keep track of
lengths, even where not necessary... there is no real reason to use
uint16_t anywhere.

Reported-by: <michael@mehlich.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-26 14:10:54 -07:00
H. Peter Anvin (Intel)
922afbfc6c test: enable debugging output
There is no reason why we should not emit debugging output when
compiling test files for manual analysis, quite the contrary.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-26 14:09:47 -07:00
H. Peter Anvin (Intel)
82fc1bea76 doc: document operator and Dx changes
Document new operators, removal of special casing for %if, and the
MASM-like enhancements to the Dx directives.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-25 15:46:09 -07:00
H. Peter Anvin (Intel)
f27ba95051 NASM 2.15rc11 2020-06-25 14:11:05 -07:00
H. Peter Anvin (Intel)
45978bb8bc BR 3392651: fix the .debug$T section in Codeview output format
The cv8 output format would generate an invalid .debug$T section,
containing repeated invalid records, none of which are actually used
(which is probably the only reason it actually worked.)

Just in case, generate a *single* type record for void func(void);

Furthermore, the argument list record should come before the procedure
type record (forward references are at least normatively prohibited.)

Reported-by: Alexandre Ganea <alexandre.ganea@ubisoft.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-25 13:57:44 -07:00
H. Peter Anvin (Intel)
7869531f27 NASM 2.15rc10 2020-06-22 13:52:46 -07:00
H. Peter Anvin (Intel)
d85a6101d7 BR 3392681: handle a64 instruction patters correctly
The a64 instruction patterns would incorrectly force REX to zero at a
point where REX prefixes have already been assigned. This is not only
incorrect in case of instructions which can use high registers, but it
causes an assertion failure. It happened to work for J*CXZ and LOOP*.

Reported-by: Philip Lantz <philip.lantz@intel.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-22 13:52:02 -07:00
H. Peter Anvin (Intel)
6e9554f067 BR 3392648: rename float.[ch] to floats.[ch]
Haiku apparently wants to include <float.h> rather than
"float.h". Rename float.[ch] to floats.[ch] to avoid unnecessary
namespace confusion.

Reported-by: <alaviss0+nasm@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-14 23:24:43 -07:00
H. Peter Anvin (Intel)
c4f95ca862 NASM 2.15rc9 2020-06-14 23:18:22 -07:00
H. Peter Anvin (Intel)
a6ea1152bc BR 3392657: dwarf: leave .debug_frame empty
Until such time that we have a CFI code generator, leave .debug_frame
empty.

Reported-by: Philip Craig <philipjcraig@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-14 23:16:50 -07:00
H. Peter Anvin (Intel)
7acbaf523c NASM 2.15rc8 2020-06-14 22:45:13 -07:00
H. Peter Anvin (Intel)
d499755f54 doc: various documentation updates 2020-06-14 22:43:47 -07:00
H. Peter Anvin (Intel)
3957f6f831 %line: quote filenames with double spaces, use unsigned char check
Filenames with double spaces need to be quoted; the preprocessor will
otherwise collapse spaces into one.

When comparing for control characters and spaces, use an unsigned
compare.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-14 20:17:57 -07:00
H. Peter Anvin (Intel)
b292748d9f preproc, srcfile: much saner handling of %line directives
%line directives really need to be preprocessed early, before normal
directive processing. In particular, they are *not* affected by such
thing as smacro expansion, or deferred into an mmacro expansion.

The %line directive is special because it is explicitly indented to be
inserted by an external preprocessor, which can happen at any point.

For mmacro and rep expansions, store the current file and line for
each expansion line. Similarly, let each istk entry contain such
information.

Don't emit empty lines in preprocessing-only mode when we are
already required to issue a %line directive anyway. This cuts down on
clutter a fair bit.

Quote filenames in %line directives (and accept quoted filenames in
%line directives) if and only if it is necessary for
disambiguation. This is required if:

1. The filename contains control characters;
2. The filename begins or ends with whitespace or a quotation mark;
3. The filename is empty.

Otherwise issue the filename as-is, for backwards compatibility.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-14 20:09:11 -07:00
H. Peter Anvin (Intel)
4ed23c8f85 preproc.c: make extra sure we always have a null-terminated token
tok_set_text() and tok_set_text_free() take a length argument, which
could at least theoretically mean that we don't have a null-terminated
string. Directly enforce a null-terminated string in all cases.

In the future this means that it is legal to intentionally use these
functions to tokenize a substring.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-14 19:55:49 -07:00
H. Peter Anvin (Intel)
00335e43ef preproc.c: make extra sure tokens are always null-terminated
In tok_set_text() and tok_set_text_free(), don't trust that
the caller has given us a zero-terminated string.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-14 19:49:19 -07:00
H. Peter Anvin (Intel)
42894381c9 preproc: even more handling of backwards compatibility for mmacros
Legacy multi-line macro argument expansion really is very
complicated. With these changes, all legacy tests seem to pass, and
the only differences with NASM 2.14.xx are that some macros which
should have been expanded and were not now are.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-14 19:42:22 -07:00
H. Peter Anvin (Intel)
2f3ada9879 NASM 2.15rc7 2020-06-08 19:06:48 -07:00
H. Peter Anvin (Intel)
ee0e3ec5a4 preproc: %clear options, backwards compatibility hack for x264
The handling of empty arguments in NASM 2.14 and below was at best
"interesting"; a single whitespace token expansion, which can happen
during macro expansion, would sometimes be counted as an argument and
sometimes not.

One really weird effect of this was that %0 doesn't always match the
permitted range in the macro specification!

Add some backwards compatibility code to make x264/ffmpeg compile.

Add override via:

    %pragma preproc sane_empty_expansion true

Add support for %clear to clear specific subsets of the macro
definitions. In particular:

    %clear defalias

... can be used to wipe the __FOO__ backwards macro compatibility
aliases which may interfere with the C namespace.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-08 19:01:48 -07:00
H. Peter Anvin (Intel)
f9f37ddcfe hashtbl.c: don't call nasm_free() for a null pointer
There really isn't much point in calling nasm_free() everywhere,
even with a null pointer...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-08 19:01:05 -07:00
H. Peter Anvin (Intel)
bacf04a3e0 preproc: need to look at mmac->in_progress not mstk->in_progress
mstk.mstk reflects %rep conditions as well as actual expanded
macros. However, in_progress is undefined for %rep loops; we instead
want to look at the underlying mmacro, if there is one.

Discovered trying to compile x264.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-08 13:29:06 -07:00
H. Peter Anvin (Intel)
ae0e50c491 NASM 2.15rc6 2020-06-05 13:24:15 -07:00
H. Peter Anvin (Intel)
30dda0b4bb travis: utf-error.stderr: remove unnecessary error message
The error message "comma expected after operand 2" no longer
occurs in this program, this is an acceptable divergence, however.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:22:32 -07:00
H. Peter Anvin (Intel)
e6d6800ead .gitignore: add *.pdf.xz
Add *.pdf.xz to the gitignore file.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:21:05 -07:00
H. Peter Anvin (Intel)
f7fadcd245 Fix missing "here" from error messages
The "here" or "in an unknown location" suffix was inadvertently
dropped.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:19:45 -07:00
H. Peter Anvin (Intel)
cc27f60fb0 travis: test avx512f should now pass
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:19:04 -07:00
H. Peter Anvin (Intel)
221ff044ba avx512: remove bogus imm8 for specific VCMP and VPCMP operations
When using VCMP and VPCMP operations with the condition in the opcode,
we should not have an immediate operand!

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:07:17 -07:00
H. Peter Anvin (Intel)
801f0c7815 avx512: implement shorthand forms of VCMP and VPCMP opcodes
The VCMP and VPCMP pseudo-op forms where the destination is a mask
were simply broken. Fix them.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 13:01:52 -07:00
H. Peter Anvin (Intel)
b91e77361a preproc: %ifdef needs to accept any argument count
%ifdef should accept any argument count. However, requiring
a macro structure return means we have to use the wildcard
argument number (-1), not 0 meaning exactly 0 arguments.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 12:22:26 -07:00
H. Peter Anvin (Intel)
0fec737e26 test/ifdef.asm: test for simple %ifdef
For some reason, %ifdef is failing now?!

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-05 12:16:23 -07:00
H. Peter Anvin
bd00f25a70 preproc: commas inside parens don't break macro arguments
Legacy NASM behavior is (quite frankly the sane one) that a comma
inside a set of parentheses do not split smacro arguments, unless
explicitly using braces to enforce this behavior. Revert to legacy
behavior, which again, is arguably the more correct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2020-06-04 21:05:01 -07:00
H. Peter Anvin (Intel)
152cbd37e2 BR 3392676: fix cmpxchg8b/16b with explicit size
CMPXCHG8b/16b should be legitimate with an explicit operand size.

Reported-by: Xusheng Li <xushengli@protonmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 20:22:34 -07:00
H. Peter Anvin (Intel)
773b87fff6 NASM 2.15rc5 2020-06-04 19:06:31 -07:00
H. Peter Anvin (Intel)
295b64541c Makefile.in: always_everything needs to depend on dirs
If the directories don't exist, we could get serious weirdness.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 18:59:25 -07:00
H. Peter Anvin (Intel)
9e5e5ec5b6 Makefile.in: Makefile.dep is not optional for external dependencies
If we have external dependencies, we need Makefile.dep to exist;
this forces make to invoke the Makefile.dep target if this file is
missing.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 18:44:23 -07:00
H. Peter Anvin (Intel)
12308896bb NASM 2.15rc4 2020-06-04 18:35:44 -07:00
H. Peter Anvin (Intel)
aaa863fbe4 mkdep.pl: remove debugging print statement
Remove debugging print statement.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 18:33:26 -07:00
H. Peter Anvin (Intel)
d23200584c Makefile: run cleandeps, no need to config.status --recheck
There is no point to run config.status --recheck just because
we have changed Makefile.in. Just run config.status.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 18:30:35 -07:00
H. Peter Anvin (Intel)
dc1a6c5306 mkdep.pl: fix internalization/externalization
At some point internalization/externalization of dependencies
apparently broke.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 18:30:27 -07:00
H. Peter Anvin (Intel)
8d03b9ccc8 release: don't include nasmdoc.pdf.xz in the -xdoc file
There is no reason to include both nasmdoc.pdf.xz and nasmdoc.pdf. For
the -xdoc file, the one with minimal dependencies is the proper one.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 17:31:17 -07:00
H. Peter Anvin (Intel)
fb7753bc2b nasm.spec.in: need perl; .pdf.xz now build by standard Makefile
Building NASM from scratch needs perl.

.pdf.xz is now build by the standard NASM Makefile.in, so don't
do it again (it causes failures.)

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 17:17:28 -07:00
H. Peter Anvin (Intel)
855f50b70b NASM 2.15rc3 2020-06-04 16:33:50 -07:00
H. Peter Anvin (Intel)
f8639bdb52 BR 3392662: handle empty argument at end of mmacro call
A trailing comma at the end of an mmacro call is an empty
argument, and so we can't terminate the argument-processing loop. The
only case where skip_white() returning NULL where we are allowed to
terminate the loop is in the case of nparams == 0, i.e. the macro call
has no arguments at all.

Reported-by: gabriele balducci <balducci@units.it>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 16:29:53 -07:00
H. Peter Anvin (Intel)
283bc92a92 nasm.c: correctly print errors once committed; assert errhold_stack empty
Properly format the error messages when we print them (oops!)

The errhold_stack should be empty after each pass. It may even be
worthwhile to make sure it is empty after each *line*, but do this
for now.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-04 16:19:51 -07:00