Commit graph

3764 commits

Author SHA1 Message Date
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
H. Peter Anvin
230db148a3 outelf.c: fix a typo in previous commit
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 15:12:03 -07:00
H. Peter Anvin
e4303ee7f1 BR 3392417: always end the DWARF .debug_abbrev section with a null
The DWARF spec specifies that the .debug_abbrev section always should
end with a null byte.  Existing tools don't seem to care, but some
issue a warning, and it is invalid according to spec.

Reported-by: Darren Sylvain <sylvaindarren@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 15:05:03 -07:00
H. Peter Anvin
f91dc2033d .gitignore: add .mo and .mo64 as generated file extensions
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 14:43:43 -07:00
H. Peter Anvin
621603da26 BR 3392418: MachO: support 16-character section names, debug flag
Support 16-character section names, and support the debug section
flag.

Reported-by: Andrey Timofeyev <timofeyev@bk.ru>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 14:42:08 -07:00
H. Peter Anvin
72a85f146e .gitignore: ignore *.dep
*.dep are automatically generated dependency files; ignore them.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 14:26:33 -07:00
H. Peter Anvin
d5e7c072bd test: add test code for BR 3392439
Bug report BR 3392439 test code.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 14:25:44 -07:00
H. Peter Anvin
e800127a46 BR3392439: make sure to update globalbits if appropriate
For some output types, the bit size, globalbits, follow the section
(segment); make sure we actually update it!

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 14:22:16 -07:00
H. Peter Anvin
5e03c443e4 .gitignore: add *.od and /misc/omfdump
A few generated files missing from .gitignore.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2017-09-27 13:48:09 -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
0bee4942a9 NASM 2.13.02rc1 2017-08-16 22:54:50 -07:00
H. Peter Anvin
fbce0bfb4e Merge remote-tracking branch 'origin/nasm-2.13.xx'
Resolved Conflicts:
	asm/directiv.dat
	asm/preproc.c
	misc/omfdump.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 22:41:40 -07:00
H. Peter Anvin
f275ce9c88 doc: update for upcoming 2.13.02 release
Update release notes and documentation for 2.13.02.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 22:36:32 -07:00
H. Peter Anvin
3e30c32812 nasm: when using -MW, quote filenames containing &
When using the -MW option, double-quote filenames containing &.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 22:20:36 -07:00
H. Peter Anvin
427b9cae8b nasm: when using -MW, enclose whitespace in double quotes
When using the -MW option, enclose whitespace-containing filenames in
double quotes.  There are probably quite a few other things we ought
to know how to do...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 22:17:51 -07:00
H. Peter Anvin
f05034fd58 nasm: when generating null targets for WMAKE, add %null
WMAKE wants an explicit %null directive; empty is not ok.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 22:09:44 -07:00
H. Peter Anvin
ff04a9ffe8 BR 3392421: consider mode decorators in instruction matching
We have to consider mode decorators when considering instruction
matching, otherwise we end up falling back to VEX encoding if it is
available, losing the decorator.  See BR 3392421.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 21:48:52 -07:00
H. Peter Anvin
c2834b9abe nasmdoc: the dbg output format is compiled in by default
These days, the dbg output format is compiled in by default, too.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 21:17:27 -07:00
H. Peter Anvin
77c9bf6cd8 nasm: new option -MW to emit Watcom-style Makefile rules
Allow NASM to generate Watcom-style Makefile dependencies, in addition
to the default POSIX-style Makefile dependencies.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 21:14:33 -07:00
H. Peter Anvin
dd47d57e4d doc/rdsrc: don't treat \# as a comment marker if preceeded by \
We need to be able to let \\# represent a literal \#, rather than
be \ followed by a comment.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 21:13:23 -07:00
H. Peter Anvin
2998226fa1 test/Makefile: output dependency information files
Generate dependency information files as output to make sure we really
do the right thing.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 16:43:04 -07:00
H. Peter Anvin
97fda4ce6e asm/preproc.c: use nasm_add_string_to_strlist()
Use nasm_add_string_to_strlist() to avoid a memory leak.
nasm_add_to_strlist() requires that the caller manages the string
being added or not.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 15:52:51 -07:00
H. Peter Anvin
cf53dfbac4 misc/omfdump.c: expand dDEPFILE COMENT records
Expand dDEPFILE COMENT records.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 15:23:01 -07:00
H. Peter Anvin
a771be85f4 outobj: emit file dependency information
Some OMF toolchain can make use of file dependency information
embedded in the object files.  As implemented here, we don't try to
absolutize the filenames, as that prevents moving around trees and is
OS-dependent.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 15:00:38 -07:00
Martin Storsjö
f283c8f5c2 preproc: Add found files to the list of dependencies even when cached
This fixes the dependency listings as generated with -MD (if
assembling runs in multiple passes).

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

gorcunov@: add missing zero byte

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:59:40 -07:00
Cyrill Gorcunov
d7a5473368 configure: Add --enable-gdb option
When one needs to run nasm under GDB

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:59:25 -07:00
Cyrill Gorcunov
750048723e preproc: Free token's text if only it has been modified
https://bugzilla.nasm.us/show_bug.cgi?id=3392414

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:59:15 -07:00
Adam Majer
91e72409be preproc: Workaround a usage after free bug
In some circumstantes this free is incorrect resulting
in usage after-free. Workaround it by not freeing memory
here.

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

gorcunov@:
 - slightly tuneup the comment

Signed-off-by: Adam Majer <amajer@suse.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2017-08-16 14:59:04 -07:00