Commit graph

136 commits

Author SHA1 Message Date
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
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
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
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
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
H. Peter Anvin
93548c2de2 rdoff: kill it off
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>
2022-11-07 16:49:13 -08:00
Igor Glucksmann
ed2c609976 output/coff: Support for COMDAT sections
Signed-off-by: "Glücksmann, Igor" <igor.glucksmann@avast.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2021-12-17 23:45:25 +03:00
H. Peter Anvin (Intel)
ed63993519 Merge remote-tracking branch 'github/nasm-2.15.xx'
No conflicts.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-09-11 18:27:06 -07:00
H. Peter Anvin (Intel)
d85890aac7 Makefile.in: fix warning dependencies
Fix circular dependency on asm/warnings.c by factoring out
warnings.$(O) from the dependencies, and use a separate <file>.time
which "generate" the main source file as a "side effect", giving us a
null target.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-09-11 18:11:51 -07:00
H. Peter Anvin (Intel)
cc843efa38 Merge tag 'nasm-2.15.04'
NASM 2.15.04

Conflicts:
	asm/listing.h
	asm/pptok.pl
	asm/preproc.c
	version

This doesn't pass travis test 3392711, which is using an extremely odd
construct of %?? in the middle of an argument sequence for an smacro
while not being in a macro itself, and expecting it to expand to the
macro name. This seems to *really* confuse the master branch.

Resolve this later...
2020-08-25 16:16:09 -07:00
H. Peter Anvin
f3a3f9925c Auto-make the warning files
The warning files are generated by a script, but the scripts is fast
enough run every time a C file is updated. To prevent having to
rebuild every file, however, make the generation script only actually
modify the file if it has changed.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-08-18 15:07:51 -07:00
H. Peter Anvin (Intel)
32322a9a93 preproc: get rid of the prepreprocessor and the nop preprocessor
Fold the prepreprocessor and the nop preprocessor into the main
preprocessor. This means handling # cpp-like lines and TASM
compatibility tokens in the preprocessor proper, but that is really
not very hard to do.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-09 23:34:52 -07:00
sezero
1969dab9c6 portability: Watcom C portability updates
- config/watcom.h: update.
- Mkfiles/openwcom.mak: -wcd=124 to silence "Comparison result always 0"
  warnings from error.h::debug_level()

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-06 13:02:26 -07:00
H. Peter Anvin (Intel)
e2040291ec config/unconfig.h: generate by Makefile, not autogen.sh
config/unconfig.h really is no different than the other perlreq files,
so move it into the Makefile. This has the extra advantage that
config/unconfig.h no longer needs to be kept in the source repository.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-07-06 11:12:03 -07:00
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)
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)
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)
418138c8f2 iflags: move definitions to a separate file; auto-generate more
Move the definitions to a separate file, in order to separate code
from data better.

We can auto-generate more information about the instruction flags, so
let's do so.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-06 22:12:11 -07:00
H. Peter Anvin
0a2b1c3498 Mkfiles: run "make cleandist"
Run "make cleandist" to update the file lists.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-26 06:31:54 -08:00
H. Peter Anvin (Intel)
df2195b6a9 Merge remote-tracking branch 'origin/nasm-2.14.xx'
Resolved Conflicts:
	Makefile.in
	Mkfiles/msvc.mak
	Mkfiles/openwcom.mak
	asm/nasm.c
	nasmlib/alloc.c

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 16:43:43 -08:00
H. Peter Anvin (Intel)
3b91f4c117 malloc: handle potential infinite loop in nasm_alloc_failed()
It is possible on memory exhaustion that nasm_fatal() might cause
another allocation error, thus calling nasm_alloc_failed() again. If
we find us in nasm_alloc_failed() for a second time, try to get a
message out and then call abort().

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 13:55:25 -08:00
H. Peter Anvin (Intel)
eb5b3ae0d3 nasmlib: Add nasm_(v)asprintf()
Add a version of (v)asprintf(), which allocates a string on the
heap. Unlike the standard version of (v)asprintf(), we return the
pointer; if one wants the length of the string then one can simply use
the %n pattern.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-12 14:34:34 -08:00
H. Peter Anvin (Intel)
64471097ca strlist: merge the strtbl and strlist interfaces
The currently-unused strtbl was basically a slightly different version
of strlist, with the find and linearize capabilities. Merge these two
together by augmenting strlist to have the same capabilities.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-11 13:37:32 -08:00
H. Peter Anvin
ba021d044b Run make cleandeps 2018-11-28 15:03:52 -08:00
H. Peter Anvin
b9fa743974 openwcom.mak: use \ as path separators
Apparently OS/2 really wants \ as path separators, and that is really
the main target for OpenWatcom these days, so change the path
separator in this Makefile.  For building on Linux we'd be better off
with a GNU Makefile anyway, but what is the point, really...

Reported-by: Andy Willis <abwillis1@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-02-22 15:02:42 -08:00
H. Peter Anvin
81b62b9f54 Eliminate filename length restrictions, remote ofmt->filename()
Get rid of remaining dependencies on FILENAME_MAX, which ought to have
been removed a long time ago.

Remove ofmt->filename(); all implementations pretty much do the same
thing and there is absolutely no reason to duplicate that
functionality all over the place.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-12-20 13:38:20 -08:00
H. Peter Anvin
ad4016952d Makefile: don't store dependency information in git
Make it possible to keep dependency information separate from the
Makefiles, so we don't have to deal with it noisifying the git logs.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-01 14:00:34 -07:00
H. Peter Anvin
77696c7768 make alldeps 2017-11-01 10:51:00 -07:00
H. Peter Anvin
0a126062fb ilog2(): inline functions if practical
For many (most?) targets these will be very small functions, so inline
them.  However, just in case make these external library functions.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 13:34:42 -07:00
H. Peter Anvin
d3e22572b3 Clean up byteorder functions
Move byte order handling functions to their own header file, and try
to be more specific about how exactly to handle things.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-24 13:01:08 -07:00
H. Peter Anvin
bf0bcef3d4 output: generic string table implementation
Several output formats use "string tables", which is a collection of
null-terminated (C) strings which are referenced by a byte offset into
the string table.  A single string can be referenced an arbitrary
number of times.

As this is quite simple to implement with a hash table, we do exactly
that.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-24 00:23:03 -07:00
H. Peter Anvin
0979957e19 nasmlib: add path-splitting functions
Some debugging formats may need to be able to split paths into
directory name and filename, at least.  This is kind of iffy, at least
across platforms, but that isn't really expected to be an issue in
practice... we hope.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-23 22:39:53 -07:00
H. Peter Anvin
8dc965347d rdoff: use nasm-provided safe memory allocation and I/O
We already have abort-on-error memory allocation and I/O operations in
nasmlib, so use them for rdoff as well.

Delete long-since-obsolete rdoff Mkfiles directory.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-04-17 13:56:50 -07:00
H. Peter Anvin
9a714c98a2 rdoff: move rdoff build into main Makefile to make it build on Windows
NSIS packages rdoff, and we really want to be able to build the full
NSIS package on an MSVC platform.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-06 17:24:03 -07:00
H. Peter Anvin
90cc4154ae BR 3392397: WMAKE uses a nonstandard syntax for phony targets
The standard syntax for a phony target in Make is:

target: <dependencies>

.PHONY: target

... however, Watcom WMAKE seems to use

target: <dependencies> .SYMBOLIC

and furthermore, seems to *require* it.  Therefore, remove the
"perlreq" target from the automatically distributed region and move it
into the specific region; it should not need to change anyway since
the PERLREQ list itself is still synced.

If it was only a matter of the .SYMBOLIC versus .PHONY token it would
be easy enough to change that in syncfiles.pl, but this syntax change
is big enough that it doesn't make enough sense to worry about.

Reported-by: sezero <sezero@users.sourceforge.net>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-05 21:24:55 -07:00
H. Peter Anvin
6c48b42466 Mkfiles: harmonize how perl and (if available) makensis is run
Use the same macros to run Perl and makensis across all Makefiles.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 11:23:31 -07:00
H. Peter Anvin
14858d7343 Makefiles: distribute file generation rules via syncfiles.pl
Distribute the file generation rules to auxiliary Makefiles via
syncfiles.pl.  These rules are OS- and Make-dialect-generic enough
that our mangling script handles them well enough.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 11:13:29 -07:00
H. Peter Anvin
526a6c7390 Rename insns-iflags.pl -> insns-iflags.ph, add missing dependency
insns-iflags.ph is included from another Perl script, so rename it .ph
(Perl header).  Add missing dependency to the main Makefile.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 10:33:12 -07:00
H. Peter Anvin
5253f58c36 Add generic perfect string hashes, use for directives
Add a generic facility for generating perfect string hashes, where all
that is needed is an enum and a string table.  The existing mechanism
using a custom Perl script wrapped around a module continues to be
available for any use case where this particular approach isn't
sophisticated enough.

Much of this patch comes from renaming "enum directives" to "enum
directive" as a result of the string hash generator expecting a set of
uniform naming conventions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-04-03 00:27:07 -07:00
H. Peter Anvin
ea33e83081 Run "make alldeps"
Missing dependencies strike again :(

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-08 01:31:10 -08:00
H. Peter Anvin
a6e26d9cca Add a generic pragma-handling infrastructure
Add infrastructure for handling %pragmas with a variety of namespaces,
etc., etc...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-07 21:32:37 -08:00
H. Peter Anvin
b20bc733c9 asm/*: Move directive processing to its own file, refactor error handling
Move directive processing to its own file, and move nasmlib/error.c to
asm/error.c (it was not used by the disassembler); remove some extern
declarations from .c files, and do some general code cleanups.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-07 19:31:04 -08:00
H. Peter Anvin
ed40e2528d Rename directiv.c to directbl.c to free up the name directiv.c
We want to move the directive handling to a separate file, so change
the filename of the directive table handler to something a bit more
specific.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-03-07 18:08:03 -08:00
H. Peter Anvin
6980985eb9 make clean: clean up more things that ought to be
Cleaning up hasn't really kept up to date with source code changes.
Try make it better for now; this also ought to make it easier to do
the corresponding cleaning in the *.mak files.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-03-01 01:23:00 -08:00
sezeroz
34b5dbe496 openwcom.mak: further fixes to build with OpenWatcom WMAKE
Further fixes for OpenWatcom/WMAKE (BR 3392383).

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-02-28 23:01:14 -08:00
H. Peter Anvin
2d6a3101f9 Run make alldeps 2017-02-28 18:14:35 -08:00
H. Peter Anvin
4d58a8fef5 Makefile: move all non-main objects into libnasm.a
There is no fundamental reason for all objects that don't contain a
main() function to not be part of libnasm.a; this allows the linker to
do its job optimally, especially in the presence of debugging code
which may not be needed under normal conditions.

If we do end up with function name conflicts the library might have to
be split, but it would be better to simply avoid that case.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-02-28 18:08:21 -08:00