Commit graph

254 commits

Author SHA1 Message Date
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
H. Peter Anvin
caffd140c0 asm: factor out more warnings into warning classes
Hopefully we'll eventually get rid of WARN_OTHER completely...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2022-11-08 17:50:45 -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
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)
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)
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)
5b4de52083 BR 3392667: more reasonable limit for expression descent
Set an expression descent limit to 8192, which is more reasonable to
expect to work on most platforms. Furthermore, if getrlimit() exists,
then try to use it to see if we need to further limit the size.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-06-01 13:21:05 -07:00
H. Peter Anvin (Intel)
941c75a2b2 Makefile portability improvement, build nasmdoc.pdf.xz
Significantly improve the portability/reliability of a general
make command. Build a .pdf.xz version of the documentation,
using an uncompressed pdf as basis.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2020-05-26 14:13:31 -07:00
H. Peter Anvin (Intel)
7be54b3d0c Makefile.in: use $(ALL_LDFLAGS)
$(ALL_LDFLAGS) was defined but not used; might as well use it.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2019-08-16 01:29:49 -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
9acfdb26da Makefile: make doc depend on warnings.src
warnings.src needs to exist for make doc to work.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-24 12:18:59 -08:00
H. Peter Anvin
54d5078c11 autogen.sh: add code to re-run configure afterwards
Add code to autogen.sh to (re-)run configure, with preserved
configuration.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-22 18:51:59 -08:00
H. Peter Anvin
b0121dc312 autoconf: use librarized autoconf setup
I have been setting up a cross-project librarized autoconf setup; use
it for NASM as well.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-22 18:17:16 -08:00
H. Peter Anvin
5307832cd1 Makefile.in: add target for running travis
Just like "make test", add "make travis".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-18 18:57:00 -08:00
Cyrill Gorcunov
b79b72fc25 build: Add warnings to PERLREQ
Missed from 723ab481a6

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2018-12-14 13:08:45 +03:00
H. Peter Anvin (Intel)
723ab481a6 warnings: define warning classes at point of use
It is extremely desirable to allow the user fine-grained control of
warnings, but this has been complicated by the fact that a warning
class has had to be defined in no less than three places (error.h,
error.c, nasmdoc.src) before it can be used in source code. Instead,
use a script to define these via magic comments at the point of use.

This hopefully will encourage creating new classes as needed.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2018-12-13 21:53:31 -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
1aa794527f Move srcfile.c to asm/
srcfile.c is not used by anything outside asm/, so move it there.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-12-10 23:03:04 -08:00
H. Peter Anvin
1350620bf1 ctype: create our own ctype table
Create our own ctype table where we can do the tests we want to do
cheaply, instead of calling ctype functions and then adding additional
tests all over the code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-11-28 14:55:58 -08:00
H. Peter Anvin
50bbafbffb Makefile.in: fix building RDOFF
Apparently it isn't just NMAKE which is sensitive to the ordering of
.SUFFIXES, it apparently applies just as well to Unix make.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 14:02:29 -07:00
H. Peter Anvin
5d8193367e MSVC: fix dependency generation and building RDOFF under MSVC
1. The mkdep.pl program didn't handle excluded dependencies correctly,
   causing it to error out due to config/config.h not existing.
2. NMAKE is sensitive to the order suffixes appear in .SUFFIXES,
   causing it to try to use the builtin rule .c.exe instead of
   .c.obj -> .obj.exe.
3. NMAKE doesn't handle the && operator between commands.
4. The !ifdef jungle around dependency generation was wrong.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2018-06-18 13:54:43 -07:00
H. Peter Anvin
675618c5dd Makefile.in: remove duplicated $(ALL_CFLAGS)
We really don't need every C compiler flag repeated twice.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2018-06-15 17:41:46 -07: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
4b70b62ba2 Makefile.in: fix typo in pathname
tools/ not qtools/

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 15:27:51 -08:00
H. Peter Anvin
cae5d06184 More autoconf modernizations; upgrade AC_PREREQ to 2.69
Make further autoconf rule improvements and update the required
version of autoconf to 2.69.  That version is now 5+ years old and
although there might be older versions which have the prerequisite
macros they are known to have lots of bugs, and we can't really test
them.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-08 10:22:10 -08:00
H. Peter Anvin
ceeaf11e66 Make dependency generation a bit more robust
Improve the corner cases where we might end up with bogus
dependencies.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-11-06 22:37:37 -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