Commit graph

3691 commits

Author SHA1 Message Date
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
dcbaf677d4 error: add --enable-panic-abort config options
For debugging purposes, make it possible to force calling abort() on
ERR_PANIC.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-12-20 12:10:33 -08:00
H. Peter Anvin
7a6bf74d02 error: add ERR_TOPFILE
Add ERR_TOPFILE, for cases where displaying the current file and line
are completely inappropriate.  Instead, display the main input file,
or, if not available, the output file.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-12-20 12:10:13 -08:00
H. Peter Anvin
883985def5 nasm.c: better handling of errors without a file without ERR_NOFILE
We have hardcoded ERR_NOFILE in a number of places which really should
not need them, and it represents loss of information.  Instead, be
robust in the handling either of no filename or no line number.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-12-20 11:32:39 -08:00
H. Peter Anvin
29dff5a29e saa.c: unify the various saa_write*() routines
Use cpu_to_le*() to unify the various saa_write*() routines.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 17:31:14 -08:00
H. Peter Anvin
f52ea70dd1 bytesex.h: more simplifications and add const
Add more simplifications where it is practical; unify WRITECHAR() as
it has no need for byte swapping in any way.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 17:19:27 -08:00
H. Peter Anvin
df5548a40c bytesex.h: make sure WRITE*() doesn't screw up on wrong pointer type
Make the WRITE*() macros independent of pointer type.  As it was, we
would get totally wrong result on X86_MEMORY machines if the pointer
was not uint8_t *.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 17:07:58 -08:00
H. Peter Anvin
7370483b00 bytesex.h: remove an unnecessary double expansion in WRITEADDR()
We can't really avoid the double expansion of (p), but the WRITE*()
macros all do that.  However, there is no reason to double-expand (s).

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:59:49 -08:00
H. Peter Anvin
8cdde2bbaa bytesex.h: simplify the trivial case of cpu_to_le*()
In the trivial case, cpu_to_le*() can just be macros containing a
single cast.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:56:59 -08:00
H. Peter Anvin
82025ea0e9 nasmlib/file.c: simplify and unify fwriteint*/addr()
The fwriteint*() and fwriteaddr() functions can be trivially unified
by using cpu_to_le*().

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:53:52 -08:00
H. Peter Anvin
b533f545e4 compiler.h: HAVE___BUILTIN_CONSTANT_P has 3 underscores
HAVE_ + __BUILTIN_CONSTANT_P makes 3 underscores...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:48:27 -08:00
H. Peter Anvin
03a5187c59 compiler.h: indentation cleanup
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:36:14 -08:00
H. Peter Anvin
b230622576 bytesex.h: unify and optimize WRITEADDR()
WRITEADDR() really doesn't need multiple implementations.  Unify them,
and optimize the case of a constant length argument (not sure if that
is currently used, however.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:05:59 -08:00
H. Peter Anvin
cb7da7e7f6 compiler.h: add is_constant()
Add macro is_constant() to return true if and only if the value is a
compile-time constant.  It may never return true, however.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:05:05 -08:00
H. Peter Anvin
e5033dfd1c configure.ac: add endian headers to configure test
- Add endian headers to the standard tests if present
- Check for __builtin_constant_p()

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:04:05 -08:00
H. Peter Anvin
2dbfdee780 aclocal.m4: correct and update PA_HAVE_FUNC()
PA_HAVE_FUNC() would fail on some systems for inline functions or
macros due to missing #includes.  Also modernize to current autoconf
style.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 16:02:52 -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
670db2fd35 Merge tag 'nasm-2.13.02'
NASM 2.13.02

Resolved Conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 11:31:36 -08:00
H. Peter Anvin
fe2f6de2ee NASM 2.13.02 2017-11-29 11:29:38 -08:00
H. Peter Anvin
075ebe7f66 doc: clean up 2.13.02 release notes, document MachO debug option
Clean up the 2.13.02 release notes: we don't need to list every single
subcase where we would crash, as it is not really relevant to the
user.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 11:25:24 -08:00
H. Peter Anvin
23b971d993 doc: clarify the BITS issue for 2.13.02.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-29 11:05:02 -08:00
Cyrill Gorcunov
d44a7c0a7c NASM 2.13.02rc3 2017-11-26 00:36:49 +03:00
Cyrill Gorcunov
8e2307caca docs: changes -- Drop leftover
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-11-25 17:42:45 +03:00
Cyrill Gorcunov
4c171ce268 doc: Update changes for 2.13.02
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-11-25 17:41:38 +03:00
H. Peter Anvin
53d8f220e1 msvc.mak: fix yet another recursion situation
We don't want to call make to rebuild msvc.dep when that is what we
are actually trying to do, over and over again...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-08 11:08:37 -08:00
H. Peter Anvin
9fd8a34938 msvc.mak: avoid infinite recursion on msvc.dep
We can't call $(MAKE) on msvc.dep if running that requires us to have
msvc.dep...

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-08 11:06:39 -08:00
H. Peter Anvin
d685bd2c4c msvc.mak: (hopefully) make external dependencies work with NMAKE
Hopefully this will make external dependencies work with NMAKE.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-08 10:59:17 -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
d428e983fe aclocal.m4: remove dnl which made autoconf complain
autoconf complained about this dnl, and it's not necessary anyway (and
perhaps even potentially harmful?

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-01 13:31:22 -07:00
H. Peter Anvin
77696c7768 make alldeps 2017-11-01 10:51:00 -07:00
H. Peter Anvin
27854e67ac aclocal.m4: add defines for added CFLAGS, cleanups, PA_SYM()
Add defines for added CFLAGS.  This can be useful, for example, for
LTO or sanitizers being enabled.

Various cleanups for readability and documentation; use macros
available in current autoconf.

Add new utility function PA_SYM(), similar to AS_TR_CPP() except
collapses sequential underscores.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-01 10:45:50 -07:00
H. Peter Anvin
ece809789e Merge remote-tracking branch 'origin/nasm-2.13.xx'
Resolved conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-11-01 10:37:18 -07:00
Cyrill Gorcunov
9b7ee09abf prepoc: Fix heap-buffer-overflow in detoken
Just make sure we've a data to process.

https://bugzilla.nasm.us/show_bug.cgi?id=3392424

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-10-22 21:42:59 +03:00
Cyrill Gorcunov
6f8109ebf1 preproc: Fix SIGSEGV if not data provided for implicit pasting
https://bugzilla.nasm.us/show_bug.cgi?id=3392423

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-10-22 21:26:36 +03:00
Cyrill Gorcunov
7524cfd914 preproc: Fix sigsegv in find_cc
For specially formed code we can have skip_white_
to end up with nil pointer which should be taken
into account.

https://bugzilla.nasm.us/show_bug.cgi?id=3392435

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-10-22 19:01:16 +03:00
Cyrill Gorcunov
59ce1c67b1 peproc: Fix sigsevg in smacro expansion
In case if smacro is called with inapropriate
number of arguments exit early. Actually we have
to handle this situation more gracefully but
this requires a way more efforts than two
line patches (need to refactor macro expansion).

https://bugzilla.nasm.us/show_bug.cgi?id=3392431

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-10-22 18:54:20 +03:00
Cyrill Gorcunov
c9244eaadd prepoc: mmacro -- Don't left nparam_max less than nparam_min
Otherwise we hit nil dereference in best case.

https://bugzilla.nasm.us/show_bug.cgi?id=3392436

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-10-22 15:25:48 +03:00
Cyrill Gorcunov
3144e84add preproc: Don't access offsting byte on unterminated strings
https://bugzilla.nasm.us/show_bug.cgi?id=3392446

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2017-10-22 10:50:55 +03:00
H. Peter Anvin
53259e8aaf configure.ac: more debugging options
Make -O0 imply -fno-omit-frame-pointer
Add options to compile/link with AddressSanitizer and
UndefinedSanitizer.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-10-11 16:47:59 -07:00
H. Peter Anvin
89215e9e37 Remove duplicate warnings for immediate overflow
For immediates, we had one overflow test in the bytecode interpreter
(in most cases via warn_overflow_opd()) and one in out(); this meant
we got two warnings instead of one every time.  Replace with only the
one in out().

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-10-11 13:14:01 -07:00
H. Peter Anvin
aaefc7fe6b BR 3392442: correct vmin in overflow_general()
The calculation of vmin in overflow_general() was bogus, causing
silliness like ~80h being warned about in a byte context.

Reported-by: C. Masloch <pushbx@38.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-10-11 13:12:17 -07:00
Andrei Vukolov
120819e73c BR 3392443: Missing prototype of alignlog2_64
The prototype:

extern int const_func alignlog2_64(uint64_t v);

were missed in ilog2.h
After adding, the build proceeds successfully.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-10-11 12:19:17 -07:00
H. Peter Anvin
9e08075278 NASM 2.13.02rc2 2017-09-27 15:58:49 -07:00
H. Peter Anvin
81fd01f9d0 BR 3392362: generate RMI versions of PEXTRW when possible
We could generate the MRI version (SSE 4.1) instead of the RMI
(SSE 2) version of these instructions if a 64-bit register was given
as the destination.

Reported-by: Vasiliy Olekhov <olekhov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 15:55:57 -07:00
H. Peter Anvin
59d5291a3a test: add Makefile target for RDOFF files
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 15:53:48 -07:00
H. Peter Anvin
e580466254 .gitignore: add more test file extensions
More file extensions used in the test directory to be ignored.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 15:32:37 -07:00
H. Peter Anvin
e38654a24e BR 3392411: smartalign: make sure we always define the end symbol
We need to always define the end symbol, otherwise we might find
ourselves in a situation where the alignment code grows (common!) and
then the symbol is defined late.

Reported-by: ig <glucksmann@avast.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 15:29:01 -07:00
H. Peter Anvin
94ead27971 BR 3392437: Fix diagnostic for negative value in TIMES
Issue a diagnostic and don't panic for invalid TIMES values.

Reported-by: C. Masloch <pushbx@38.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 15:22:23 -07:00