Commit Graph

5058 Commits

Author SHA1 Message Date
H. Peter Anvin
4d9c102e44 Nindent: modernize (greatly simplify) and move to tools/ 2023-10-12 14:28:58 -07:00
H. Peter Anvin
03490692b0 BR 3392832: fix dependency list generation
The dependency list needs to be updated for all passes, not just the
last one. The dependency list is already uniquized, so it doesn't
cause problems with multiple entires.

The reasons it needs to be done for all passes is first of all that an
%include could be pass-dependent, and secondly that we only record a
dependency for an %include or %require for the first occurrence of
that file, when pathnames are resolved.

Reported-by <michael@mehlich@com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 14:35:49 -07:00
H. Peter Anvin
cba25274a3 NASM 2.16.02rc2 2023-10-11 14:17:03 -07:00
C. Masloch
d48839780d BR 3392892: fix memory leak related to BR 3392414
The fix for BR 3392414 introduced a fairly serious memory
leak. C. Masloch was kind enough to track down the proper root cause
and fix it correctly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:58:48 -07:00
H. Peter Anvin
8fc4af0cf9 assemble.c: fix a typo in warning texts
Fix a typo in the help text for the -w+reloc options.

Reported-by: C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:42:31 -07:00
H. Peter Anvin
2daa5989ab error: macro to bypass disabled warning generation
At least attempt to not spend time generating a warning message that
is just going to be suppressed.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:35:58 -07:00
H. Peter Anvin
0e7eae99e8 autoconf: add detection of variadic macros support
Variadic macros are really useful, even if we can only use them
conditionally.

Unfortunately this means removing -Wc90-c99-compat, because apparently
-Wno-variadic-macros is broken in gcc 13.2. Fortunately it is 2023...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:32:52 -07:00
H. Peter Anvin
e64ae0a0c6 BR 3392571: allow the user to request warnings for relocations
Some target environments may have specific restrictions on what kinds
of relocations are possible or allowed. Allow users to opt-in to
specific warnings as to the relocations they cannot support.

Requested-by: C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 12:34:52 -07:00
H. Peter Anvin
73676357de BR 3392906: error out on bad syntax "db 1 2"
NASM would try to "eat the comma token" in db expressions, even for
cases where the token was not a comma. Fix that and error out
properly.

To give better error messages, track where in the input string a token
starts or ends. This information is only valid as long as the input
string is kept, but that is just fine for error messages during
parsing.

Reported-by: Peter Cordes <pcordes@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 12:06:58 -07:00
H. Peter Anvin
816f50e5f5 compiler.h: add missing new #include "autoconf/attributes.h"
The attributes macro is contained in a header file; this header file
needs to be included.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 12:06:18 -07:00
H. Peter Anvin
0e96487608 autoconf: modernize autoconf and update a lot of m4 macros 2023-10-11 10:47:09 -07:00
H. Peter Anvin
ec4e4126e3 doc: add a few tags to the html output format
It may be possible to generate the printed documentation from the
HTML, with a suitable combination of print-only CSS. Definitely not
there yet, though.
2023-10-11 10:38:18 -07:00
H. Peter Anvin
8917088988 Nindent: modernize (greatly simplify) and move to tools/ 2023-10-11 10:37:34 -07:00
H. Peter Anvin
a16a45e6ca autoconf: modernize autoconf and update a lot of m4 macros 2023-10-11 10:19:16 -07:00
H. Peter Anvin
b9528913aa NASM 2.16.02rc1 2023-02-19 21:39:16 -08:00
H. Peter Anvin
ea49bac9b9 autogen: add --cleanenv option and use it in the release script
Make sure we don't pick up any local things from the environment.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-02-19 21:37:37 -08:00
H. Peter Anvin
a916e4127b Merge remote-tracking branch 'github/nasm-2.16.xx' 2023-02-19 21:29:46 -08:00
H. Peter Anvin
8ce37daeea doc/changes.src: update to reflect current state
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-02-19 21:28:49 -08:00
H. Peter Anvin
5a2d629501 autoconf: a much of macro fixes... not sure how this ever worked?
Exposed a bunch of problems with the autoconf m4 macro
library. Hopefulyy fix it, and tidy it up in the process.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-02-19 21:26:15 -08:00
H. Peter Anvin
cb29058de0 Merge in the current state of the 2.16.xx branch 2023-02-19 16:31:42 -08:00
H. Peter Anvin
7e80d6b834 Make: handle warning files while building in a directory
The dependency on the warning files breaks when we are building in a
directory *and* the files already exist from being shipped with the
distribution tarballs. The make VPATH simply isn't sophisticated
enough to deal with it, so let the C compiler handle it by #including
the generated file from a dummy C file.

Reported-by: Rudi Heitbaum <rudi@heitbaum.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-01-17 13:05:55 -08:00
H. Peter Anvin
66a91c3796 Makefile: unbreak "make dist"
Things used by "make dist" haven't been updated for a while, it seems;
in particular have not kept up with the existence of autogen.sh.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-01-17 12:27:10 -08:00
H. Peter Anvin
e847465bb5 Merge remote-tracking branch 'github/nasm-2.16.xx'
Resolved Conflicts:
	doc/changes.src

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-21 18:40:08 -08:00
H. Peter Anvin
80eebbcb5c .gitignore: add misc/nasmtok.el, make whole rdoff directory ignored
misc/nasmtok.el is a generated file.
The whole rdoff directory is obsolete; if someone still has it it can
be ignored.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-21 18:37:26 -08:00
H. Peter Anvin
d41598b335 NASM 2.16.01 2022-12-21 18:36:24 -08:00
H. Peter Anvin
8d5d663607 doc: html: add Chapter 1 to navbar in the TOC
Add Chapter 1 to the navbar for the table of contents, for ease of
sequentially reading the whole document.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-21 18:35:17 -08:00
H. Peter Anvin
b67d42380c doc: fix HTML table of contents generation
Fix the HTML table of contents being completely broken.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-21 18:23:27 -08:00
H. Peter Anvin
49bbfed017 autoconf, doc: fix comment in header to pa_have_func.m4
Comment change only

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-21 18:19:19 -08:00
H. Peter Anvin
feac856c54 version: this is now the 2.17 development branch
2.16 has been released, this is now officially the 2.17 development
branch.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-20 21:55:08 -08:00
H. Peter Anvin
4563bee993 NASM 2.16 2022-12-20 21:33:17 -08:00
H. Peter Anvin
17b1582d0d Merge branch 'master' of ssh://github.com/netwide-assembler/nasm 2022-12-20 21:32:34 -08:00
H. Peter Anvin
07245bc574 NASM 2.16rc12 2022-12-07 10:58:33 -08:00
H. Peter Anvin
9607c6685f doc/changes.src: document obj segment fix
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-07 10:55:20 -08:00
H. Peter Anvin
cab5b75145 output: when converting OUT_SEGMENT to legacy, don't lose the addend
When converting an OUT_SEGMENT relocation to legacy, the addend is
still significant, as it would represent an explicit addend to the
segment number.

Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392783
Reported-by: David Fifield <david@bamsoftware.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-07 10:51:33 -08:00
H. Peter Anvin
c8af731120 outieee: fix segfault on empty input
Fix the IEEE backend crashing if the input file is empty.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-07 10:24:14 -08:00
H. Peter Anvin
55dc058356 Document CPU LATEVEX, add CPU EVEX and CPU VEX flags
Document CPU LATEVEX and the associated prefixes; add CPU EVEX and CPU
VEX flags to further control encodings.

Fix the error message for invalid encodings due to flags.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-07 10:11:21 -08:00
H. Peter Anvin
494d9531dd travis: fix the masmdisp travis test
The masmdisp travis test incorrectly contained an expectation of
error, from the bug fixed in checkin
e0959432fe.

Fix the test to contain the actually expected output.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-07 09:45:36 -08:00
H. Peter Anvin
638d5bc4e4 NASM 2.16rc11 2022-12-06 13:41:55 -08:00
H. Peter Anvin
91c33896a3 latevex: add test file
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-06 13:41:33 -08:00
H. Peter Anvin
9f31c84405 insns: handle late-introduced VEX encoded instructions
For VEX instructions created *after* the corresponding EVEX
instructions, we need the user to either explicitly declare them {vex}
or specifying "cpu latevex".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-12-06 13:38:33 -08:00
H. Peter Anvin
87d621c79d Merge remote-tracking branch 'github/emacs' 2022-11-23 14:37:03 -08:00
H. Peter Anvin
d3afc5c1d7 doc: bring doc/changes.src up to date
Bring doc/changes.src up to date with the current status of tree in
preparation for the 2.16 release.

Note that no 2.15.06 release ever was produced.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-23 14:35:04 -08:00
H. Peter Anvin
9939a2c00e NASM 2.16rc10 2022-11-21 12:18:58 -08:00
H. Peter Anvin
488d7c7bee preproc: fix memory leak in %[...] processing
"Why dup_tlist() here? We should own it."

Yes, we own it, but we still need to advance the tail pointer. Create
steal_tlist() for this purpose.

Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392774
Reported-and-Debugged-by: C. Masloch <pushbx@ulukai.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-21 12:08:07 -08:00
H. Peter Anvin
ae0d289123 preproc: avoid crashing on %exitmacro in broken nesting
Broken %if, %rep and %macro nesting can result in the %exitmacro
unwind overrunning the condition stack. Fix.

Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392796
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-21 11:51:15 -08:00
C. Masloch
65d1eca5c6 preproc: fix incorrect use of nasm_new() in alloc_Token()
The argument to nasm_new() is the pointer, not the indirection from
the pointer. This code is only relevant when compiled without token
recycling (TOKEN_BLOCKSIZE not set), but it is still wrong...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-21 11:26:26 -08:00
C. Masloch
e0959432fe preproc: fix the expansion of %00 (token type change)
Fix the expansion of the %00 mmacro parameter; broken due to a missing
change of the token type.

Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392803
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-21 11:21:47 -08:00
H. Peter Anvin
516fbba03e preproc: add conditional-string smacro parameters; simplify functions
Add the option of having strings only conditionally quoted (&&) -- do
not quote an already quoted string again -- as opposed to always
quoting a string.

This makes a lot of the string functions way simpler to implement, and
removes the need to share ad hoc parsing code with directives.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-21 10:54:19 -08:00
H. Peter Anvin
30ff4f92c0 NASM 2.16rc9 2022-11-17 15:32:16 -08:00
H. Peter Anvin
36cd305ade preproc: add %abs(), modify %num(), refactor
Add the %abs() function, to produce the absolute value as an
always-positive decimal constant.

Change the order of the arguments for %num().

Refactor the handling of optional arguments, to reduce the amount of
redundant code. This is currently only used for builtin functions, but
might be extended in the future.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-17 15:29:10 -08:00