0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00
Commit Graph

294 Commits

Author SHA1 Message Date
H. Peter Anvin
cd5dfb8c5f warnings: always regenerate outputs; tidy up unnecessary rules
With warnings disaggregated, there is no reason to play games with not
updating the output timestamp. Always write the files as usual.

Remove unnecessary Makefile rules.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
1# Please enter the commit message for your changes. Lines starting
2025-10-04 14:04:31 -07:00
H. Peter Anvin
69f1aa6c6a Makefile.in: re-introduce rules that can be made common
Rules that are now simple again can be made common.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-04 13:55:21 -07:00
H. Peter Anvin
a8bcdb641b Warnings: disaggregate from source and tidy up documentation
The idea of putting the warnings in the source code was a nice one,
really, but it ended up being a nightmare from the perspective of
build dependencies. Disaggregate them, and tweak the documentation for
easier reading.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-04 13:46:39 -07:00
H. Peter Anvin
a179a1a826 install: add option for installing .pdf.xz; fix RPMs
- Add an option to use "make install" to install .pdf.xz

- Fix RPM spec file to put the documentation in doc/nasm instead of
  doc/nasm-doc.

- RPM doesn't like unversioned Obsoletes; set a valid cutoff.

- Make nasm-doc depend on nasm.

- Add zlib-devel as a build dependency.

- Add EXTRA_CFLAGS and EXTRA_LDFLAGS for some automated platforms.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-02 17:11:52 -07:00
H. Peter Anvin
7415a1e5f8 Build: update various build installation directories
Modernize and improve the handling of build directories.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-02 16:08:04 -07:00
H. Peter Anvin
534edcba04 editors: add JSON output
Add JSON formatted editor help output as a way to help more general
editor support code.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-02 14:18:57 -07:00
H. Peter Anvin
01e40a9aeb Move editor help files to editors/, add NASM version number
Move the editor help files (currently nasmtok.el) to the editors/
subdirectory in anticipation of having more such files.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-02 13:49:43 -07:00
H. Peter Anvin
dfacf9a3d7 Makefiles: remove warnings generation from auxiliary Makefiles
The .time trick doesn't seem to work in general, and auxiliary
Makefiles aren't guaranteed to build modified sources anyway.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-01 13:55:33 -07:00
H. Peter Anvin
205512f3c0 Makefile: a few more portability improvements
Define macros for generating an empty file and for a dummy (side
effect) target.

Tweak MSVC compiler options.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-01 13:55:07 -07:00
H. Peter Anvin
a54a902f4e Makefile: unbreak msvc.mak
With these changes msvc.mak works on Visual Studio 2022.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-01 13:54:04 -07:00
H. Peter Anvin
4acc3dbccc Fix more license headers 2025-10-01 12:05:34 -07:00
H. Peter Anvin
945d4327b5 build: even more fixes for building in a separate directory
Move the directories dependency to a variable to break secondary make
versions.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-25 13:28:08 -07:00
H. Peter Anvin
fb9afe4226 build: more fixes for building in a separate build directory
- Fix additional broken rules
- Add some more files to WARNOBJ
- $^ is not supported by POSIX, apparently
- Update warnings.pl to *actually* use the srcdir and list of
  passed-in files.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-25 13:20:29 -07:00
H. Peter Anvin
1f095bea4a Makefile.in: fix rules for separate-directory build
1. POSIX does not allow $< in a non-pattern rule.
2. insns.xda is a build-time generated file.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-25 12:18:02 -07:00
H. Peter Anvin
729abf395d Makefile.in: remove additional path guards
They don't work, and can cause problems.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-25 09:46:11 -07:00
H. Peter Anvin
5f67f04f00 Makefile: make nsis building work in a separate build directory
Use $< rather than the hard-coded path

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-25 09:30:12 -07:00
H. Peter Anvin
ac1a64c4d2 Makefile: move syncfiles into a separate target
It isn't actually required to have $(PERLREQ) to run syncfiles,
so factor it out into a separate target.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-25 09:26:01 -07:00
H. Peter Anvin
512f587ed6 Makefile.in: remove '' filename protect; they don't work anyway
Using '' filename protects break the generated alternative makefiles,
but it is also largely useless -- building in relative paths which
require escaping breaks anyway as make and the shell would require
different escaping.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-25 09:13:16 -07:00
H. Peter Anvin
276cbf9682 autoconf/Makefile.in: add include for local zlib
When using the internal zlib, need to make sure to add the appropriate
-I option for the header...

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 18:36:28 -07:00
H. Peter Anvin
1d63ae2a3b doc: update the documentation, and auto-generate some indexes
There are currently six variations of each conditionals, and there may
be more in the future (e.g. %while). Stop trying to enumerate them all
everywhere.

Add support for index copying in the document processor.

Have pptok.pl auto-generate index metadata for conditional
preprocessor directives.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 17:12:06 -07:00
H. Peter Anvin
f39677d527 test: add -DSRC as a standard option; bin32 and bin64 targets
Make it a little easier to run bench tests which include multiple bit
sizes, and add the SRC define to make SRC/BIN tests easier to run on
the bench.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-05 12:56:46 -07:00
H. Peter Anvin
31a160759d Add %ifdirective preprocessor directive
Along with C and other languages, the current trend is to be able to
probe for features rather than relying on version numbers. This is
motivated in part by the intent of bumping the major version number to
3.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-09-04 19:41:12 -07:00
H. Peter Anvin
6c105cea3b Improve misc/omfdump, add misc/Makefile, use -std=c23 if possible
- Add improvements to omfdump from Bernd Böckmann.

- Add misc/Makefile with option to install omfdump and auxiliary NASM
  data files.

- Use compiler.h and friends in the misc directory.

- Use -std=c23 if the C compiler supports it.

Cc: Bernd Boeckmann <bernd-github@boeckmann.io>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2025-09-03 10:05:21 -07:00
H. Peter Anvin
e05867ce3d ndisasm: make the assembler (hopefully) work again
- Significantly overhauled the disassembler internals to make
  better use of the information already in the instruction template
  and to reduce the implementation differences with the assembler
- Add APX support to the disassembler
- Fix problem with disassembler truncating addresses of jumps
- Fix generation of invalid EAs in 16-bit mode
- Fix array overrun for types in a few modules
- Fix invalid ND flag on near JMP

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-30 16:16:43 -07:00
H. Peter Anvin
050c275c39 Makefile: factor out the disassembler
Factor the objects ONLY needed for the disassembler into a
separate library. This allows building the assembler even while
the disassembler is not yet buildable; this makes working on
the disassembler easier.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-29 13:26:44 -07:00
H. Peter Anvin
83534f1f37 Merge remote-tracking branch 'origin/master' into apx.wip
Resolved Conflicts:
	Makefile.in
	Mkfiles/msvc.mak
	Mkfiles/openwcom.mak
	asm/assemble.c
	asm/nasm.c
	asm/parser.c
	doc/Makefile.in
	include/nasm.h
	include/tables.h
	output/legacy.c
	travis/test/br3392531.stderr
	travis/test/br3392716.stderr
	travis/test/org.stderr
	x86/insns.dat

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-25 21:09:15 -07:00
H. Peter Anvin
df4555d68b preproc: compress standard macros with zlib
The very simple compression scheme used for the builtin macro sets no
longer works adequately, and in fact it generates incorrect output
now.

Drop the whole idea of an ad hoc compression scheme and just use
zlib. For the case where there is no system zlib available, include a
(subset of) the zlib distribution. The configure script can be set to
force this included zlib if desired (e.g. for testing.)

Unfortunately this turned out to be a pretty painful can of worms in
terms of complexity. On the other hand having zlib available might be
useful at some point in the future.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-15 16:51:39 -07:00
H. Peter Anvin
2726aefb06 output: remove the legacy output entry point
Remove the legacy output entry point. It has proven impossible to find
the time to completely port the backends all at once.

Instead, always generate the legacy output data, but put them into the
out_data structure. Then add a macro to explode these arguments into
separate variables, equivalent to the old function arguments. This
also centralizes the type definitions for these variables.

Most importantly, it means that the entire struct out_data is now
always available, which means that backends that need the additional
information available in that structure, such as the specific
instruction template, can access that information without needing to
revamp the entire backend code all at once.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-08-13 13:51:25 -07:00
H. Peter Anvin
67339f6965 insns: rename addflags.pl to preinsns.pl; use insns.xda for doc
The former addflags.pl now does more general preprocessing, so rename
it from addflags.pl to preinsns.pl.

To generate the instruction list in the documentation, use the
post-preprocessed insns.xda file.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-08-11 21:34:02 -07:00
H. Peter Anvin
d49f49b04c Makefile.in: fix "make cleaner"/"make spotless"
Generated files $(PERLREQ_CLEANABLE) never got cleaned up due to an
incorrect reference.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-08-04 16:07:52 -07:00
H. Peter Anvin
e1a912308e Makefile.in: change .dax -> .xda to unbreak tab completion
.dat versus .dax is annoying for tab completion, change the extension
for the preprocessed insns.dat to .xda.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-08-04 16:04:16 -07:00
H. Peter Anvin
c79b6a97f0 insns.dat: script to auto-generate ZU and FL flags
These are mostly structured. Leave this as an explicit processing
step, at least until the correctness of these flags have been fully
verified; perhaps after that as well.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-08-03 19:07:57 -07:00
H. Peter Anvin
1286a2da4e Tidy up handling of modr/m and compressed immediates
Merge a bunch of common code in the handling of modr/m
generation. Make the handing of compressed disp8 simpler and more
transparent by exporting a the shift factor for the compressed
immediate in ea_data. For the case of no compression, the shift factor
is simply 0; there is no need to distinguish "compressed" from
"uncompressed".

The tidied up version of the disp8 code is simple enough that it makes
more sense to inline it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-08-03 16:24:49 -07:00
H. Peter Anvin
2e4df506e0 WIP: APX: can now generate code for tested APX instructions
a
Support generating code for APX instruction and add support for the
{nf} prefix.

No disassembler support yet, and only a handful instructions encoded.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-07-29 20:58:04 -07:00
H. Peter Anvin
aa03a95edd doc: improve the build from source documentation
Update and improve the build from source documentation, including add
an auto-generated list of Perl build dependencies.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2024-05-20 10:54:26 -07:00
H. Peter Anvin
99fec7e7d0 Makefile: more cleanup/dist fixes
Even more fixes to the various clean and dist targets, sigh.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 14:35:56 -07:00
H. Peter Anvin
0553c6f306 Makefile: fix "make dist" and "make tar"
These aren't used to actually make a distribution, but they are useful
for testing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 14:21:51 -07:00
H. Peter Anvin
25f701e689 spec generation: try to distinguish use pragmas from modules
Assume module names (for "use") always start with a capital letter,
and that anything that doesn't is a pragma.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 14:05:32 -07:00
H. Peter Anvin
caaf81c22e deps: don't break if run in a build directory; don't delete unconfig.h
Don't break Makefile.dep generation if run from a separate build
directory.

config/unconfig.h is a bit special; it is kept in the repository for
the benefit of non-configure users. Therefore, don't have "make
spotless" delete it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 13:17:40 -07:00
H. Peter Anvin
392f47d06e Makefile: fix "make spotless"
Fix "make spotless" and some of the related targets so they actually
behave sensibly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-12 12:05:52 -07:00
H. Peter Anvin
b11cd3a426 warnings: more improvements to warnings generation
Try to better sort out the necessary dependencies for warning
generation.

Fix regex for cleaning up nasmdoc markup: nasmdoc markup does not
nest, although it may include \} sequences.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 14:18:34 -07:00
H. Peter Anvin
99175565d8 Makefile.in: remove configure remnants from "make distclean"
"make distclean" (which is used to generate release tarballs) should
remove configure-generated files.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-04-04 13:45:29 -07:00
H. Peter Anvin
66276870f2 Makefiles: defined $(WARNSRCS), but need to actually use it...
The $(WARNSRCS) definition doesn't help much unless it is actually
used somewhere...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 19:07:54 -08:00
H. Peter Anvin
4bf01032e5 Makefiles: try to fix compiling with MSVC/nmake
Try to address Makefile portability bugs affecting MSVC/nmake.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 19:00:15 -08:00
H. Peter Anvin
1e965e30ff windows host: add embedded manifest file
Without a manifest, Windows applications force a fixed PATH_MAX limit
to any pathname; this is unnecessary.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2024-01-29 17:19:32 -08:00
H. Peter Anvin
34eefd3803 preproc: add %map() function and radix specifiers
Add the %map() function which can apply arguments to a macro from a
list.

Allow the user to specify the desired radix for an evaluated
parameter. It doesn't make any direct difference, but can be nice for
debugging or turning into strings.

As part of this, split expand_one_smacro() into two parts: parameter
parsing and macro expansion. This is a very straightforward splitting
of two mostly unrelated pieces of functionality.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-15 22:43:28 -07: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
2d5cf17130 misc/emacstbl.pl: add NASM version to output, add to Makefile
Include the version number in the output (misc/nasmtok.el) and add a
rule for generating it to the Makefiles.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-17 12:52:52 -08:00
H. Peter Anvin
a2eabbe1d7 insns: drop special handling of conditional instructions
Instead of handling conditional instructions ad hoc, generate
individual instruction patterns as normal. This simplifies the code
and makes CMPccXADD support simpler (otherwise it would be necessary
to hack in the handling of a condition code in the middle of an
instruction.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-12 12:37:37 -08:00