Merge remote-tracking branch 'github/nasm-2.15.xx'

No conflicts.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2020-09-11 18:27:06 -07:00
commit ed63993519
18 changed files with 216 additions and 60 deletions

1
.gitignore vendored
View File

@ -26,6 +26,7 @@
*.srec
*.si
*.swp
*.time
*.win32
*.win64
*.xml

View File

@ -75,7 +75,7 @@ ifeq ($(TRACE),1)
endif
.SUFFIXES:
.SUFFIXES: $(X) .$(O) .$(A) .xml .1 .c .i .s .txt
.SUFFIXES: $(X) .$(O) .$(A) .xml .1 .c .i .s .txt .time
.PHONY: all doc rdf install clean distclean cleaner spotless install_rdf test
.PHONY: install_doc everything install_everything strip perlreq dist tags TAGS
@ -100,7 +100,10 @@ endif
NASM = asm/nasm.$(O)
NDISASM = disasm/ndisasm.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
PROGOBJ = $(NASM) $(NDISASM)
PROGS = nasm$(X) ndisasm$(X)
LIBOBJ_NW = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
stdlib/strnlen.$(O) stdlib/strrchrnul.$(O) \
\
nasmlib/ver.$(O) \
@ -122,7 +125,7 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
x86/disp8.$(O) x86/iflag.$(O) \
\
asm/error.$(O) asm/warnings.$(O) \
asm/error.$(O) \
asm/floats.$(O) \
asm/directiv.$(O) asm/directbl.$(O) \
asm/pragma.$(O) \
@ -146,7 +149,12 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
\
disasm/disasm.$(O) disasm/sync.$(O)
ALLOBJ = $(NASM) $(NDISASM) $(LIBOBJ)
# Warnings depend on all source files, so handle them separately
WARNOBJ = asm/warnings.$(O)
LIBOBJ = $(LIBOBJ_NW) $(WARNOBJ)
ALLOBJ_NW = $(PROGOBJ) $(LIBOBJ_NW)
ALLOBJ = $(PROGOBJ) $(LIBOBJ)
SUBDIRS = stdlib nasmlib output asm disasm x86 common macros
XSUBDIRS = test doc nsis rdoff
@ -154,7 +162,7 @@ DEPDIRS = . include config x86 rdoff $(SUBDIRS)
#-- End File Lists --#
all: dirs
$(MAKE) nasm$(X) ndisasm$(X) rdf
$(MAKE) $(PROGS) rdf
NASMLIB = libnasm.$(A)
@ -270,18 +278,30 @@ warnings:
$(RM_F) $(WARNFILES)
$(MAKE) asm/warnings.time
asm/warnings.time: $(ALLOBJ:.@OBJEXT@=.c)
asm/warnings.time: $(ALLOBJ_NW:.$(O)=.c)
: > asm/warnings.time
$(MAKE) $(WARNFILES)
$(MAKE) $(WARNFILES:=.time)
asm/warnings.c: asm/warnings.pl asm/warnings.time
asm/warnings.c.time: asm/warnings.pl asm/warnings.time
$(RUNPERL) $(srcdir)/asm/warnings.pl c asm/warnings.c $(srcdir)
: > asm/warnings.c.time
include/warnings.h: asm/warnings.pl asm/warnings.time
asm/warnings.c: asm/warnings.c.time
@: Side effect
include/warnings.h.time: asm/warnings.pl asm/warnings.time
$(RUNPERL) $(srcdir)/asm/warnings.pl h include/warnings.h $(srcdir)
: > include/warnings.h.time
doc/warnings.src: asm/warnings.pl asm/warnings.time
include/warnings.h: include/warnings.h.time
@: Side effect
doc/warnings.src.time: asm/warnings.pl asm/warnings.time
$(RUNPERL) $(srcdir)/asm/warnings.pl doc doc/warnings.src $(srcdir)
: > doc/warnings.src.time
doc/warnings.src : doc/warnings.src.time
@: Side effect
# Assembler token hash
asm/tokhash.c: x86/insns.dat x86/regs.dat asm/tokens.dat asm/tokhash.pl \
@ -384,10 +404,9 @@ nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh
# Generated manpages, also pregenerated for distribution
manpages: nasm.1 ndisasm.1
install: nasm$(X) ndisasm$(X)
install: $(PROGS)
$(MKDIR_P) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) nasm$(X) $(DESTDIR)$(bindir)/nasm$(X)
$(INSTALL_PROGRAM) ndisasm$(X) $(DESTDIR)$(bindir)/ndisasm$(X)
$(INSTALL_PROGRAM) $(PROGS) $(DESTDIR)$(bindir)/
$(MKDIR_P) $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) $(srcdir)/nasm.1 $(DESTDIR)$(mandir)/man1/nasm.1
$(INSTALL_DATA) $(srcdir)/ndisasm.1 $(DESTDIR)$(mandir)/man1/ndisasm.1
@ -396,7 +415,7 @@ clean:
for d in . $(SUBDIRS) $(XSUBDIRS); do \
$(RM_F) "$$d"/*.$(O) "$$d"/*.s "$$d"/*.i "$$d"/*.$(A) ; \
done
$(RM_F) nasm$(X) ndisasm$(X)
$(RM_F) $(PROGS)
$(RM_F) nasm-*-installer-*.exe
$(RM_F) tags TAGS
$(RM_F) nsis/arch.nsh
@ -411,18 +430,18 @@ distclean: clean
done
$(RM_F) test/*.$(O)
$(RM_RF) autom4te*.cache
$(RM_F) Makefile *.dep asm/warnings.time
$(RM_F) Makefile *.dep
cleaner: clean
$(RM_F) $(PERLREQ) *.1 nasm.spec
$(MAKE) -C doc clean
$(RM_F) *.dep asm/warnings.time
$(RM_F) *.dep */*.time
spotless: distclean cleaner
$(RM_F) doc/Makefile
strip:
$(STRIP) --strip-unneeded nasm$(X) ndisasm$(X)
$(STRIP) --strip-unneeded $(PROGS)
TAGS:
$(RM_F) TAGS
@ -495,13 +514,13 @@ nasm.spec: nasm.spec.in nasm.spec.sed version.sed perlbreq.si
splint:
splint -weak *.c
test: nasm$(X)
test: $(PROGS)
cd test && $(RUNPERL) performtest.pl --nasm=../nasm *.asm
golden: nasm$(X)
golden: $(PROGS)
cd test && $(RUNPERL) performtest.pl --golden --nasm=../nasm *.asm
travis: nasm$(X)
travis: $(PROGS)
$(PYTHON3) travis/nasm-t.py run
#

View File

@ -64,7 +64,10 @@ X = .exe
NASM = asm\nasm.$(O)
NDISASM = disasm\ndisasm.$(O)
LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) \
PROGOBJ = $(NASM) $(NDISASM)
PROGS = nasm$(X) ndisasm$(X)
LIBOBJ_NW = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) \
stdlib\strnlen.$(O) stdlib\strrchrnul.$(O) \
\
nasmlib\ver.$(O) \
@ -86,7 +89,7 @@ LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) \
x86\regs.$(O) x86\regvals.$(O) x86\regflags.$(O) x86\regdis.$(O) \
x86\disp8.$(O) x86\iflag.$(O) \
\
asm\error.$(O) asm\warnings.$(O) \
asm\error.$(O) \
asm\floats.$(O) \
asm\directiv.$(O) asm\directbl.$(O) \
asm\pragma.$(O) \
@ -110,7 +113,12 @@ LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) \
\
disasm\disasm.$(O) disasm\sync.$(O)
ALLOBJ = $(NASM) $(NDISASM) $(LIBOBJ)
# Warnings depend on all source files, so handle them separately
WARNOBJ = asm\warnings.$(O)
LIBOBJ = $(LIBOBJ_NW) $(WARNOBJ)
ALLOBJ_NW = $(PROGOBJ) $(LIBOBJ_NW)
ALLOBJ = $(PROGOBJ) $(LIBOBJ)
SUBDIRS = stdlib nasmlib output asm disasm x86 common macros
XSUBDIRS = test doc nsis rdoff
@ -229,18 +237,30 @@ warnings:
$(RM_F) $(WARNFILES)
$(MAKE) asm\warnings.time
asm\warnings.time: $(ALLOBJ:.@OBJEXT@=.c)
asm\warnings.time: $(ALLOBJ_NW:.$(O)=.c)
: > asm\warnings.time
$(MAKE) $(WARNFILES)
$(MAKE) $(WARNFILES:=.time)
asm\warnings.c: asm\warnings.pl asm\warnings.time
asm\warnings.c.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings.c $(srcdir)
: > asm\warnings.c.time
include\warnings.h: asm\warnings.pl asm\warnings.time
asm\warnings.c: asm\warnings.c.time
@: Side effect
include\warnings.h.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl h include\warnings.h $(srcdir)
: > include\warnings.h.time
doc\warnings.src: asm\warnings.pl asm\warnings.time
include\warnings.h: include\warnings.h.time
@: Side effect
doc\warnings.src.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl doc doc\warnings.src $(srcdir)
: > doc\warnings.src.time
doc\warnings.src : doc\warnings.src.time
@: Side effect
# Assembler token hash
asm\tokhash.c: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl \

View File

@ -53,7 +53,10 @@ X = .exe
NASM = asm\nasm.$(O)
NDISASM = disasm\ndisasm.$(O)
LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) &
PROGOBJ = $(NASM) $(NDISASM)
PROGS = nasm$(X) ndisasm$(X)
LIBOBJ_NW = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) &
stdlib\strnlen.$(O) stdlib\strrchrnul.$(O) &
&
nasmlib\ver.$(O) &
@ -75,7 +78,7 @@ LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) &
x86\regs.$(O) x86\regvals.$(O) x86\regflags.$(O) x86\regdis.$(O) &
x86\disp8.$(O) x86\iflag.$(O) &
&
asm\error.$(O) asm\warnings.$(O) &
asm\error.$(O) &
asm\floats.$(O) &
asm\directiv.$(O) asm\directbl.$(O) &
asm\pragma.$(O) &
@ -99,7 +102,12 @@ LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) &
&
disasm\disasm.$(O) disasm\sync.$(O)
ALLOBJ = $(NASM) $(NDISASM) $(LIBOBJ)
# Warnings depend on all source files, so handle them separately
WARNOBJ = asm\warnings.$(O)
LIBOBJ = $(LIBOBJ_NW) $(WARNOBJ)
ALLOBJ_NW = $(PROGOBJ) $(LIBOBJ_NW)
ALLOBJ = $(PROGOBJ) $(LIBOBJ)
SUBDIRS = stdlib nasmlib output asm disasm x86 common macros
XSUBDIRS = test doc nsis rdoff
@ -242,18 +250,30 @@ warnings:
$(RM_F) $(WARNFILES)
$(MAKE) asm\warnings.time
asm\warnings.time: $(ALLOBJ:.@OBJEXT@=.c)
asm\warnings.time: $(ALLOBJ_NW:.$(O)=.c)
: > asm\warnings.time
$(MAKE) $(WARNFILES)
$(MAKE) $(WARNFILES:=.time)
asm\warnings.c: asm\warnings.pl asm\warnings.time
asm\warnings.c.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings.c $(srcdir)
: > asm\warnings.c.time
include\warnings.h: asm\warnings.pl asm\warnings.time
asm\warnings.c: asm\warnings.c.time
@: Side effect
include\warnings.h.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl h include\warnings.h $(srcdir)
: > include\warnings.h.time
doc\warnings.src: asm\warnings.pl asm\warnings.time
include\warnings.h: include\warnings.h.time
@: Side effect
doc\warnings.src.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl doc doc\warnings.src $(srcdir)
: > doc\warnings.src.time
doc\warnings.src : doc\warnings.src.time
@: Side effect
# Assembler token hash
asm\tokhash.c: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl &

View File

@ -279,17 +279,20 @@ if ($what eq 'c') {
close($out);
# Write data to file if and only if it has changed
# Windows requires append mode here
open($out, '+>>', $outfile)
or die "$0: cannot open output file $outfile: $!\n";
my $datalen = length($outdata);
my $oldlen = read($out, my $oldoutdata, $datalen+1);
if (!defined($oldlen) || $oldlen != $datalen ||
!($oldoutdata eq $outdata)) {
# Data changed, must rewrite
truncate($out, 0);
seek($out, 0, SEEK_SET)
or die "$0: cannot rewind output file $outfile: $!\n";
print $out $outdata;
# For some systems, even if we don't write, opening for append
# apparently touches the timestamp, so we need to read and write
# as separate operations.
if (open(my $out, '<', $outfile)) {
my $datalen = length($outdata);
my $oldlen = read($out, my $oldoutdata, $datalen+1);
close($out);
exit 0 if (defined($oldlen) && $oldlen == $datalen &&
($oldoutdata eq $outdata));
}
# Data changed, must rewrite
open(my $out, '>', $outfile)
or die "$0: cannot open output file $outfile: $!\n";
print $out $outdata;
close($out);

View File

@ -9,8 +9,8 @@ since 2007.
\S{cl-2.15.05} Version 2.15.05
\b Correct \c{%ifid $} and \c{%ifid $$} being treated as true. See
\k{iftyp}.
\b Fix \c{%ifid $} and \c{%ifid $$} incorrectly being treated as
true. See \k{iftyp}.
\b Add \c{--reproducible} option to suppress NASM version numbers and
timestamps in output files. See \k{opt-reproducible}.

View File

@ -3376,9 +3376,13 @@ string.
The conditional assembly construct \c{%ifid}, taking one parameter
(which may be blank), assembles the subsequent code if and only if
the first token in the parameter exists and is an identifier.
\c{%ifnum} works similarly, but tests for the token being a numeric
constant; \c{%ifstr} tests for it being a string.
\e{the first token} in the parameter exists and is an
identifier. \c{$} and \c{$$} are \e{not} considered identifiers by
\c{%ifid}.
\c{%ifnum} works similarly, but tests for the token being an integer
numeric constant (not an expression!) possibly preceeded by \c{+} or
\c{-}; \c{%ifstr} tests for it being a quoted string.
For example, the \c{writefile} macro defined in \k{mlmacgre} can be
extended to take advantage of \c{%ifstr} in the following fashion:

View File

@ -63,7 +63,7 @@ for cmd in ['new']:
required = False)
spp.add_argument('--error',
dest = 'error',
help = 'Set to "y" if test is supposed to fail',
help = '"y" if test is supposed to fail or "i" to ignore',
required = False)
spp.add_argument('--output',
dest = 'output', default = 'y',
@ -500,7 +500,9 @@ if args.cmd == 'new':
if args.ref:
acc.append("\t\t\"ref\": \"{}\"".format(args.ref))
if args.error == 'y':
acc.append("\t\t\"error\": \"true\"")
acc.append("\t\t\"error\": \"expected\"")
elif args.error == 'i':
acc.append("\t\t\"error\": \"over\"")
f.write(",\n".join(acc).encode("utf-8"))
if args.output or args.stdout or args.stderr:
acc = []

View File

@ -0,0 +1,4 @@
and byte [0], ~80h
and byte [0], 0xfff
and byte [0], -256
and byte [0], -257

BIN
travis/test/br3392442.bin.t Normal file

Binary file not shown.

View File

@ -0,0 +1,13 @@
[
{
"description": "Test br3392442",
"id": "br3392442",
"format": "bin",
"source": "br3392442.asm",
"option": "-Ox",
"target": [
{ "output": "br3392442.bin" },
{ "stderr": "br3392442.stderr" }
]
}
]

View File

@ -0,0 +1,2 @@
./travis/test/br3392442.asm:2: warning: byte data exceeds bounds [-w+number-overflow]
./travis/test/br3392442.asm:4: warning: byte data exceeds bounds [-w+number-overflow]

View File

@ -0,0 +1 @@
./travis/test/br3392707.asm:6: error: expecting `)'

23
travis/test/br3392707.asm Normal file
View File

@ -0,0 +1,23 @@
bits 32
db 33
db (44)
%ifdef ERROR
db (44,55)
%endif
db %(44.55)
db %('XX','YY')
db ('AA')
db %('BB')
db ?
db 6 dup (33)
db 6 dup (33, 34)
db 6 dup (33, 34), 35
db 7 dup (99)
db 7 dup (?,?)
dw byte (?,44)
dw 0xcc, 4 dup byte ('PQR'), ?, 0xabcd
dd 16 dup (0xaaaa, ?, 0xbbbbbb)
dd 64 dup (?)

BIN
travis/test/br3392707.bin.t Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
[
{
"description": "Test br3392707",
"id": "br3392707",
"format": "bin",
"source": "br3392707.asm",
"option": "-Ox",
"target": [
{ "output": "br3392707.bin" },
{ "stderr": "br3392707.stderr" }
]
},
{
"description": "Test br3392707 (error)",
"ref": "br3392707",
"option": "-o br3392707.bin -DERROR -Ox",
"target": [
{ "stderr": "br3392707-error.stderr" }
],
"error": "expected"
}
]

View File

@ -0,0 +1,22 @@
./travis/test/br3392707.asm:10: warning: byte data exceeds bounds [-w+number-overflow]
./travis/test/br3392707.asm:12: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:17: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:18: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:20: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:22: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]
./travis/test/br3392707.asm:23: warning: uninitialized space declared in .text section: zeroing [-w+zeroing]

View File

@ -1,11 +1,11 @@
[
{
"description": "Test warning stack",
"id": "warnstack",
"format": "bin",
"source": "warnstack.asm",
"option": "-Ox",
"target": [
"id": "warnstack",
"format": "bin",
"source": "warnstack.asm",
"option": "-Ox",
"target": [
{ "output": "warnstack.bin" },
{ "stderr": "warnstack.stderr" }
]