mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-10-10 00:25:06 -04:00
Merge remote-tracking branch 'origin/nasm-2.12.xx'
Resolved Conflicts: .gitignore Makefile.in Mkfiles/msvc.mak Mkfiles/netware.mak Mkfiles/openwcom.mak Mkfiles/owlinux.mak preproc-nop.c preproc.c version Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -3,6 +3,7 @@
|
|||||||
*.dbg
|
*.dbg
|
||||||
*.exe
|
*.exe
|
||||||
*.lib
|
*.lib
|
||||||
|
*.i
|
||||||
*.lst
|
*.lst
|
||||||
*.o
|
*.o
|
||||||
*.o64
|
*.o64
|
||||||
@@ -12,8 +13,9 @@
|
|||||||
*.out
|
*.out
|
||||||
*.pdb
|
*.pdb
|
||||||
*.rej
|
*.rej
|
||||||
*.xml
|
*.s
|
||||||
*.swp
|
*.swp
|
||||||
|
*.xml
|
||||||
.*swo
|
.*swo
|
||||||
*~
|
*~
|
||||||
\#*
|
\#*
|
||||||
@@ -40,6 +42,7 @@ TAGS
|
|||||||
/doc/*.txt
|
/doc/*.txt
|
||||||
/doc/Makefile
|
/doc/Makefile
|
||||||
/doc/inslist.src
|
/doc/inslist.src
|
||||||
|
/doc/version.src
|
||||||
/doc/html
|
/doc/html
|
||||||
/doc/info
|
/doc/info
|
||||||
/insnsa.c
|
/insnsa.c
|
||||||
|
25
Makefile.in
25
Makefile.in
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
objdir = @builddir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
exec_prefix = @exec_prefix@
|
exec_prefix = @exec_prefix@
|
||||||
@@ -30,7 +31,7 @@ RANLIB = @RANLIB@
|
|||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
|
|
||||||
PERL = perl
|
PERL = perl
|
||||||
PERLFLAGS = -I$(srcdir)/perllib
|
PERLFLAGS = -I$(srcdir)/perllib -I$(srcdir)
|
||||||
RUNPERL = $(PERL) $(PERLFLAGS)
|
RUNPERL = $(PERL) $(PERLFLAGS)
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
@@ -105,7 +106,8 @@ NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) \
|
|||||||
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
||||||
nasmlib/nasmlib.$(O) nasmlib/ver.$(O) \
|
nasmlib/nasmlib.$(O) nasmlib/ver.$(O) \
|
||||||
nasmlib/file.$(O) nasmlib/realpath.$(O) \
|
nasmlib/file.$(O) nasmlib/realpath.$(O) \
|
||||||
nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O)
|
nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O) \
|
||||||
|
nasmlib/srcfile.$(O)
|
||||||
#-- End File Lists --#
|
#-- End File Lists --#
|
||||||
|
|
||||||
all: nasm$(X) ndisasm$(X) rdf
|
all: nasm$(X) ndisasm$(X) rdf
|
||||||
@@ -127,7 +129,7 @@ ndisasm$(X): $(NDISASM) $(NASMLIB)
|
|||||||
# instruction-table file by a Perl script. They're distributed,
|
# instruction-table file by a Perl script. They're distributed,
|
||||||
# though, so it isn't necessary to have Perl just to recompile NASM
|
# though, so it isn't necessary to have Perl just to recompile NASM
|
||||||
# from the distribution.
|
# from the distribution.
|
||||||
INSDEP = insns.dat insns.pl insns-iflags.pl
|
INSDEP = insns.dat insns.pl
|
||||||
|
|
||||||
iflag.c: $(INSDEP)
|
iflag.c: $(INSDEP)
|
||||||
$(RUNPERL) $(srcdir)/insns.pl -fc $(srcdir)/insns.dat
|
$(RUNPERL) $(srcdir)/insns.pl -fc $(srcdir)/insns.dat
|
||||||
@@ -219,9 +221,11 @@ perlreq: $(PERLREQ)
|
|||||||
nsis/arch.nsh: nsis/getpearch.pl nasm$(X)
|
nsis/arch.nsh: nsis/getpearch.pl nasm$(X)
|
||||||
$(PERL) $(srcdir)/nsis/getpearch.pl nasm$(X) > nsis/arch.nsh
|
$(PERL) $(srcdir)/nsis/getpearch.pl nasm$(X) > nsis/arch.nsh
|
||||||
|
|
||||||
# Should only be done after "make everything"
|
# Should only be done after "make everything".
|
||||||
|
# The use of redirection here keeps makensis from moving the cwd to the
|
||||||
|
# source directory.
|
||||||
nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh
|
nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh
|
||||||
$(MAKENSIS) nsis/nasm.nsi
|
$(MAKENSIS) -Dsrcdir="$(srcdir)" -Dobjdir="$(objdir)" - < "$<"
|
||||||
|
|
||||||
# Generated manpages, also pregenerated for distribution
|
# Generated manpages, also pregenerated for distribution
|
||||||
manpages: nasm.1 ndisasm.1
|
manpages: nasm.1 ndisasm.1
|
||||||
@@ -382,6 +386,8 @@ nasmlib/nasmlib.$(O): nasmlib/nasmlib.c compiler.h config.h directiv.h \
|
|||||||
pptok.h preproc.h regs.h tables.h tokens.h
|
pptok.h preproc.h regs.h tables.h tokens.h
|
||||||
nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h config.h nasmint.h \
|
nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h config.h nasmint.h \
|
||||||
nasmlib.h
|
nasmlib.h
|
||||||
|
nasmlib/srcfile.$(O): nasmlib/srcfile.c compiler.h config.h hashtbl.h \
|
||||||
|
nasmint.h nasmlib.h
|
||||||
nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
|
nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
|
||||||
ndisasm.$(O): ndisasm.c compiler.h config.h directiv.h disasm.h iflag.h \
|
ndisasm.$(O): ndisasm.c compiler.h config.h directiv.h disasm.h iflag.h \
|
||||||
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
|
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
|
||||||
@@ -411,11 +417,10 @@ output/outcoff.$(O): output/outcoff.c compiler.h config.h directiv.h eval.h \
|
|||||||
output/outdbg.$(O): output/outdbg.c compiler.h config.h directiv.h insnsi.h \
|
output/outdbg.$(O): output/outdbg.c compiler.h config.h directiv.h insnsi.h \
|
||||||
nasm.h nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h \
|
nasm.h nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h \
|
||||||
regs.h tables.h
|
regs.h tables.h
|
||||||
output/outelf.$(O): output/outelf.c compiler.h config.h directiv.h \
|
output/outelf.$(O): output/outelf.c compiler.h config.h directiv.h eval.h \
|
||||||
eval.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h \
|
insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
|
||||||
output/elf.h output/outelf.h output/outform.h output/outlib.h \
|
output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
|
||||||
output/stabs.h pptok.h preproc.h raa.h rbtree.h regs.h saa.h stdscan.h \
|
preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
|
||||||
tables.h ver.h
|
|
||||||
output/outform.$(O): output/outform.c compiler.h config.h directiv.h \
|
output/outform.$(O): output/outform.c compiler.h config.h directiv.h \
|
||||||
insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/outform.h pptok.h \
|
insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/outform.h pptok.h \
|
||||||
preproc.h regs.h tables.h
|
preproc.h regs.h tables.h
|
||||||
|
@@ -35,7 +35,7 @@ INTERNAL_CFLAGS = /I$(srcdir) /I. \
|
|||||||
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
|
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
|
||||||
LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE /RELEASE
|
LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE /RELEASE
|
||||||
LIBS =
|
LIBS =
|
||||||
PERL = perl -I$(srcdir)/perllib
|
PERL = perl -I$(srcdir)/perllib -I$(srcdir)
|
||||||
|
|
||||||
# Binary suffixes
|
# Binary suffixes
|
||||||
O = obj
|
O = obj
|
||||||
@@ -75,7 +75,8 @@ NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) \
|
|||||||
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
||||||
nasmlib/nasmlib.$(O) nasmlib/ver.$(O) \
|
nasmlib/nasmlib.$(O) nasmlib/ver.$(O) \
|
||||||
nasmlib/file.$(O) nasmlib/realpath.$(O) \
|
nasmlib/file.$(O) nasmlib/realpath.$(O) \
|
||||||
nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O)
|
nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O) \
|
||||||
|
nasmlib/srcfile.$(O)
|
||||||
#-- End File Lists --#
|
#-- End File Lists --#
|
||||||
|
|
||||||
all: nasm$(X) ndisasm$(X)
|
all: nasm$(X) ndisasm$(X)
|
||||||
@@ -296,6 +297,8 @@ nasmlib/nasmlib.$(O): nasmlib/nasmlib.c compiler.h directiv.h iflag.h \
|
|||||||
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
|
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
|
||||||
preproc.h regs.h tables.h tokens.h
|
preproc.h regs.h tables.h tokens.h
|
||||||
nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h nasmint.h nasmlib.h
|
nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h nasmint.h nasmlib.h
|
||||||
|
nasmlib/srcfile.$(O): nasmlib/srcfile.c compiler.h hashtbl.h nasmint.h \
|
||||||
|
nasmlib.h
|
||||||
nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
|
nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
|
||||||
ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
|
ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
|
||||||
insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
|
insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
|
||||||
@@ -324,8 +327,8 @@ output/outcoff.$(O): output/outcoff.c compiler.h directiv.h eval.h insnsi.h \
|
|||||||
output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
|
output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
|
||||||
nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
|
nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
|
||||||
tables.h
|
tables.h
|
||||||
output/outelf.$(O): output/outelf.c compiler.h directiv.h eval.h \
|
output/outelf.$(O): output/outelf.c compiler.h directiv.h eval.h insnsi.h \
|
||||||
insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
|
nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
|
||||||
output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
|
output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
|
||||||
preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
|
preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
|
||||||
output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
|
output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
|
||||||
|
@@ -56,7 +56,8 @@ NDISASM = ndisasm.o disasm.o sync.o \
|
|||||||
LIBOBJ = snprintf.o vsnprintf.o strlcpy.o \
|
LIBOBJ = snprintf.o vsnprintf.o strlcpy.o \
|
||||||
nasmlib.o ver.o \
|
nasmlib.o ver.o \
|
||||||
file.o realpath.o \
|
file.o realpath.o \
|
||||||
ilog2.o md5c.o crc64.o
|
ilog2.o md5c.o crc64.o \
|
||||||
|
srcfile.o
|
||||||
#-- End File Lists --#
|
#-- End File Lists --#
|
||||||
|
|
||||||
NASM_OBJ = $(addprefix $(OBJDIR)/,$(notdir $(NASM))) $(EOLIST)
|
NASM_OBJ = $(addprefix $(OBJDIR)/,$(notdir $(NASM))) $(EOLIST)
|
||||||
@@ -183,6 +184,7 @@ nasmlib.o: nasmlib.c compiler.h config.h directiv.h iflag.h iflaggen.h \
|
|||||||
insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
|
insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
|
||||||
regs.h tables.h tokens.h
|
regs.h tables.h tokens.h
|
||||||
realpath.o: realpath.c compiler.h config.h nasmint.h nasmlib.h
|
realpath.o: realpath.c compiler.h config.h nasmint.h nasmlib.h
|
||||||
|
srcfile.o: srcfile.c compiler.h config.h hashtbl.h nasmint.h nasmlib.h
|
||||||
ver.o: ver.c ver.h version.h
|
ver.o: ver.c ver.h version.h
|
||||||
ndisasm.o: ndisasm.c compiler.h config.h directiv.h disasm.h iflag.h \
|
ndisasm.o: ndisasm.c compiler.h config.h directiv.h disasm.h iflag.h \
|
||||||
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
|
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
|
||||||
|
@@ -22,7 +22,7 @@ LD = *wlink
|
|||||||
LDEBUG =
|
LDEBUG =
|
||||||
LDFLAGS = op quiet $(%TARGET_LFLAGS) $(LDEBUG)
|
LDFLAGS = op quiet $(%TARGET_LFLAGS) $(LDEBUG)
|
||||||
LIBS =
|
LIBS =
|
||||||
PERL = perl -I$(srcdir)/perllib
|
PERL = perl -I$(srcdir)/perllib -I$(srcdir)
|
||||||
|
|
||||||
STRIP = wstrip
|
STRIP = wstrip
|
||||||
|
|
||||||
@@ -72,7 +72,8 @@ NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) &
|
|||||||
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) &
|
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) &
|
||||||
nasmlib/nasmlib.$(O) nasmlib/ver.$(O) &
|
nasmlib/nasmlib.$(O) nasmlib/ver.$(O) &
|
||||||
nasmlib/file.$(O) nasmlib/realpath.$(O) &
|
nasmlib/file.$(O) nasmlib/realpath.$(O) &
|
||||||
nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O)
|
nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O) &
|
||||||
|
nasmlib/srcfile.$(O)
|
||||||
#-- End File Lists --#
|
#-- End File Lists --#
|
||||||
|
|
||||||
what: .SYMBOLIC
|
what: .SYMBOLIC
|
||||||
@@ -323,6 +324,8 @@ nasmlib/nasmlib.$(O): nasmlib/nasmlib.c compiler.h config.h directiv.h &
|
|||||||
pptok.h preproc.h regs.h tables.h tokens.h
|
pptok.h preproc.h regs.h tables.h tokens.h
|
||||||
nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h config.h nasmint.h &
|
nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h config.h nasmint.h &
|
||||||
nasmlib.h
|
nasmlib.h
|
||||||
|
nasmlib/srcfile.$(O): nasmlib/srcfile.c compiler.h config.h hashtbl.h &
|
||||||
|
nasmint.h nasmlib.h
|
||||||
nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
|
nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
|
||||||
ndisasm.$(O): ndisasm.c compiler.h config.h directiv.h disasm.h iflag.h &
|
ndisasm.$(O): ndisasm.c compiler.h config.h directiv.h disasm.h iflag.h &
|
||||||
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h &
|
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h &
|
||||||
@@ -352,11 +355,10 @@ output/outcoff.$(O): output/outcoff.c compiler.h config.h directiv.h eval.h &
|
|||||||
output/outdbg.$(O): output/outdbg.c compiler.h config.h directiv.h insnsi.h &
|
output/outdbg.$(O): output/outdbg.c compiler.h config.h directiv.h insnsi.h &
|
||||||
nasm.h nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h &
|
nasm.h nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h &
|
||||||
regs.h tables.h
|
regs.h tables.h
|
||||||
output/outelf.$(O): output/outelf.c compiler.h config.h directiv.h &
|
output/outelf.$(O): output/outelf.c compiler.h config.h directiv.h eval.h &
|
||||||
eval.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h &
|
insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h &
|
||||||
output/elf.h output/outelf.h output/outform.h output/outlib.h &
|
output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h &
|
||||||
output/stabs.h pptok.h preproc.h raa.h rbtree.h regs.h saa.h stdscan.h &
|
preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
|
||||||
tables.h ver.h
|
|
||||||
output/outform.$(O): output/outform.c compiler.h config.h directiv.h &
|
output/outform.$(O): output/outform.c compiler.h config.h directiv.h &
|
||||||
insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/outform.h pptok.h &
|
insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/outform.h pptok.h &
|
||||||
preproc.h regs.h tables.h
|
preproc.h regs.h tables.h
|
||||||
|
@@ -37,7 +37,7 @@ ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
|
|||||||
LD = $(CC)
|
LD = $(CC)
|
||||||
LDFLAGS = $(ALL_CFLAGS)
|
LDFLAGS = $(ALL_CFLAGS)
|
||||||
LIBS =
|
LIBS =
|
||||||
PERL = perl -I$(srcdir)/perllib
|
PERL = perl -I$(srcdir)/perllib -I$(srcdir)
|
||||||
|
|
||||||
STRIP = wstrip
|
STRIP = wstrip
|
||||||
|
|
||||||
@@ -83,7 +83,8 @@ NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) \
|
|||||||
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
|
||||||
nasmlib/nasmlib.$(O) nasmlib/ver.$(O) \
|
nasmlib/nasmlib.$(O) nasmlib/ver.$(O) \
|
||||||
nasmlib/file.$(O) nasmlib/realpath.$(O) \
|
nasmlib/file.$(O) nasmlib/realpath.$(O) \
|
||||||
nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O)
|
nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O) \
|
||||||
|
nasmlib/srcfile.$(O)
|
||||||
#-- End File Lists --#
|
#-- End File Lists --#
|
||||||
|
|
||||||
what:
|
what:
|
||||||
@@ -288,6 +289,8 @@ nasmlib/nasmlib.$(O): nasmlib/nasmlib.c compiler.h directiv.h iflag.h \
|
|||||||
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
|
iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
|
||||||
preproc.h regs.h tables.h tokens.h
|
preproc.h regs.h tables.h tokens.h
|
||||||
nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h nasmint.h nasmlib.h
|
nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h nasmint.h nasmlib.h
|
||||||
|
nasmlib/srcfile.$(O): nasmlib/srcfile.c compiler.h hashtbl.h nasmint.h \
|
||||||
|
nasmlib.h
|
||||||
nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
|
nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
|
||||||
ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
|
ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
|
||||||
insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
|
insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
|
||||||
@@ -316,8 +319,8 @@ output/outcoff.$(O): output/outcoff.c compiler.h directiv.h eval.h insnsi.h \
|
|||||||
output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
|
output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
|
||||||
nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
|
nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
|
||||||
tables.h
|
tables.h
|
||||||
output/outelf.$(O): output/outelf.c compiler.h directiv.h eval.h \
|
output/outelf.$(O): output/outelf.c compiler.h directiv.h eval.h insnsi.h \
|
||||||
insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
|
nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
|
||||||
output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
|
output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
|
||||||
preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
|
preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
|
||||||
output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
|
output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
|
||||||
|
@@ -334,7 +334,7 @@ static void out(int64_t offset, int32_t segto, const void *data,
|
|||||||
int32_t segment, int32_t wrt)
|
int32_t segment, int32_t wrt)
|
||||||
{
|
{
|
||||||
static int32_t lineno = 0; /* static!!! */
|
static int32_t lineno = 0; /* static!!! */
|
||||||
static char *lnfname = NULL;
|
static const char *lnfname = NULL;
|
||||||
uint8_t p[8];
|
uint8_t p[8];
|
||||||
int asize = addrsize(type, size); /* Address size in bytes */
|
int asize = addrsize(type, size); /* Address size in bytes */
|
||||||
const int amax = ofmt->maxbits >> 3; /* Maximum address size in bytes */
|
const int amax = ofmt->maxbits >> 3; /* Maximum address size in bytes */
|
||||||
|
@@ -5,3 +5,4 @@
|
|||||||
autoheader
|
autoheader
|
||||||
autoconf
|
autoconf
|
||||||
rm -rf autom4te.cache config.log config.status
|
rm -rf autom4te.cache config.log config.status
|
||||||
|
rm -f Makefile rdoff/Makefile doc/Makefile config.h
|
||||||
|
@@ -191,5 +191,5 @@ PA_ADD_CFLAGS([-Werror=missing-declarations])
|
|||||||
PA_ADD_CFLAGS([-Werror=comment])
|
PA_ADD_CFLAGS([-Werror=comment])
|
||||||
PA_ADD_CFLAGS([-Werror=vla])])
|
PA_ADD_CFLAGS([-Werror=vla])])
|
||||||
|
|
||||||
AC_OUTPUT_COMMANDS([mkdir -p output])
|
AC_OUTPUT_COMMANDS([mkdir -p nasmlib nsis output stdlib])
|
||||||
AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)
|
AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
# UNIX Makefile for NASM documentation
|
# UNIX Makefile for NASM documentation
|
||||||
#
|
#
|
||||||
|
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
@@ -16,7 +17,7 @@ INSTALL = @INSTALL@
|
|||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
|
||||||
PERL = perl
|
PERL = perl -I$(srcdir)
|
||||||
MAKEINFO = makeinfo
|
MAKEINFO = makeinfo
|
||||||
TEXI2DVI = texi2dvi
|
TEXI2DVI = texi2dvi
|
||||||
TEXI2IPF = texi2ipf
|
TEXI2IPF = texi2ipf
|
||||||
@@ -26,7 +27,7 @@ ACRODIST = @ACRODIST@ # Acrobat Distiller
|
|||||||
PSTOPDF = @PSTOPDF@ # BSD/MacOS X utility
|
PSTOPDF = @PSTOPDF@ # BSD/MacOS X utility
|
||||||
PS2PDF = @PS2PDF@ # Part of GhostScript
|
PS2PDF = @PS2PDF@ # Part of GhostScript
|
||||||
|
|
||||||
SRCS = nasmdoc.src inslist.src changes.src
|
SRCS = nasmdoc.src inslist.src changes.src version.src
|
||||||
OUT = info html nasmdoc.txt nasmdoc.ps nasmdoc.pdf
|
OUT = info html nasmdoc.txt nasmdoc.ps nasmdoc.pdf
|
||||||
|
|
||||||
# exports
|
# exports
|
||||||
@@ -38,28 +39,35 @@ all: $(OUT)
|
|||||||
os2: nasm.inf
|
os2: nasm.inf
|
||||||
|
|
||||||
inslist.src: inslist.pl ../insns.dat
|
inslist.src: inslist.pl ../insns.dat
|
||||||
$(PERL) $(srcdir)/inslist.pl
|
$(PERL) $(srcdir)/inslist.pl $(srcdir)/../insns.dat
|
||||||
|
|
||||||
.PHONY: html
|
.PHONY: html
|
||||||
html: html/nasmdoc0.html
|
html: html/nasmdoc0.html
|
||||||
|
|
||||||
|
RDSRC = $(PERL) $(srcdir)/rdsrc.pl -I$(srcdir)/
|
||||||
|
|
||||||
html/nasmdoc0.html: $(SRCS) rdsrc.pl
|
html/nasmdoc0.html: $(SRCS) rdsrc.pl
|
||||||
mkdir -p html
|
mkdir -p html
|
||||||
$(PERL) $(srcdir)/rdsrc.pl html < $<
|
$(RDSRC) html "$<"
|
||||||
mv -f *.html html
|
mv -f *.html html
|
||||||
|
|
||||||
nasmdoc.dip: $(SRCS) rdsrc.pl
|
nasmdoc.dip: $(SRCS) rdsrc.pl
|
||||||
$(PERL) $(srcdir)/rdsrc.pl dip < $<
|
$(RDSRC) dip "$<"
|
||||||
|
|
||||||
nasmdoc.texi: $(SRCS) rdsrc.pl
|
nasmdoc.texi: $(SRCS) rdsrc.pl
|
||||||
$(PERL) $(srcdir)/rdsrc.pl texi < $<
|
$(RDSRC) texi "$<"
|
||||||
|
|
||||||
nasmdoc.txt: $(SRCS) rdsrc.pl
|
nasmdoc.txt: $(SRCS) rdsrc.pl
|
||||||
$(PERL) $(srcdir)/rdsrc.pl txt < $<
|
$(RDSRC) txt "$<"
|
||||||
|
|
||||||
nasmdoc.ps: nasmdoc.dip nasmlogo.eps $(srcdir)/../version genpsdriver.pl \
|
version.src: $(top_srcdir)/version.pl $(top_srcdir)/version
|
||||||
genps.pl psfonts.ph pswidth.ph head.ps
|
$(PERL) $(top_srcdir)/version.pl docsrc \
|
||||||
$(PERL) $(srcdir)/genpsdriver.pl > nasmdoc.ps
|
< $(top_srcdir)/version > version.src
|
||||||
|
|
||||||
|
nasmdoc.ps: nasmdoc.dip nasmlogo.eps \
|
||||||
|
genps.pl psfonts.ph pswidth.ph head.ps
|
||||||
|
$(PERL) $(srcdir)/genps.pl -headps $(srcdir)/head.ps nasmdoc.dip \
|
||||||
|
> nasmdoc.ps
|
||||||
|
|
||||||
nasmdoc.pdf: nasmdoc.ps
|
nasmdoc.pdf: nasmdoc.ps
|
||||||
$(ACRODIST) -n -q --nosecurity -o $@ $< || \
|
$(ACRODIST) -n -q --nosecurity -o $@ $< || \
|
||||||
@@ -88,7 +96,7 @@ nasm.inf: nasmdoc.ipf
|
|||||||
clean:
|
clean:
|
||||||
-rm -f *.rtf *.hpj *.texi *.gid *.ipf *.dip
|
-rm -f *.rtf *.hpj *.texi *.gid *.ipf *.dip
|
||||||
-rm -f *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr
|
-rm -f *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr
|
||||||
-rm -f inslist.src
|
-rm -f inslist.src version.src
|
||||||
|
|
||||||
spotless: clean
|
spotless: clean
|
||||||
-rm -rf html info
|
-rm -rf html info
|
||||||
|
@@ -8,6 +8,26 @@ The NASM 2 series supports x86-64, and is the production version of NASM
|
|||||||
since 2007.
|
since 2007.
|
||||||
|
|
||||||
|
|
||||||
|
\S{cl-2.12.02} Version 2.12.02
|
||||||
|
|
||||||
|
\b Fix preprocessor errors, especially \c{%error} and \c{%warning},
|
||||||
|
inside \c{%if} statements.
|
||||||
|
|
||||||
|
\b Fix relative relocations in 32-bit Mach-O.
|
||||||
|
|
||||||
|
\b More Codeview debug format fixes.
|
||||||
|
|
||||||
|
\b If the MASM PTR keyword is encountered, issue a warning. This is
|
||||||
|
much more likely to indicate a MASM-ism encountered in NASM than it
|
||||||
|
is a valid label. This warning can be suppressed with \c{-w-ptr},
|
||||||
|
the \c{[warning]} directive (see \k{opt-w}) or by the macro
|
||||||
|
definition \c{%idefine ptr %??}.
|
||||||
|
|
||||||
|
\b When an error or a warning comes from the expansion of a multi-line
|
||||||
|
macro, display the file and line numbers for the expanded macros.
|
||||||
|
Macros defined with \c{.nolist} do not get displayed.
|
||||||
|
|
||||||
|
|
||||||
\S{cl-2.12.01} Version 2.12.01
|
\S{cl-2.12.01} Version 2.12.01
|
||||||
|
|
||||||
\b Portability fixes for some platforms.
|
\b Portability fixes for some platforms.
|
||||||
@@ -48,7 +68,7 @@ since 2007.
|
|||||||
\b Allow 64-bit outputs in 16/32-bit only backends. Unsigned 64-bit
|
\b Allow 64-bit outputs in 16/32-bit only backends. Unsigned 64-bit
|
||||||
relocations are zero-extended from 32-bits with a warning
|
relocations are zero-extended from 32-bits with a warning
|
||||||
(suppressible via \c{-w-zext-reloc}); signed 64-bit relocations are
|
(suppressible via \c{-w-zext-reloc}); signed 64-bit relocations are
|
||||||
an arror.
|
an error.
|
||||||
|
|
||||||
\b Line numbers in list files now correspond to the lines in the source
|
\b Line numbers in list files now correspond to the lines in the source
|
||||||
files, instead of simply being sequential.
|
files, instead of simply being sequential.
|
||||||
|
13
doc/genps.pl
13
doc/genps.pl
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
## --------------------------------------------------------------------------
|
## --------------------------------------------------------------------------
|
||||||
##
|
##
|
||||||
## Copyright 1996-2012 The NASM Authors - All Rights Reserved
|
## Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
## See the file AUTHORS included with the NASM distribution for
|
## See the file AUTHORS included with the NASM distribution for
|
||||||
## the specific copyright holders.
|
## the specific copyright holders.
|
||||||
##
|
##
|
||||||
@@ -36,9 +36,6 @@
|
|||||||
# Format the documentation as PostScript
|
# Format the documentation as PostScript
|
||||||
#
|
#
|
||||||
|
|
||||||
use Env;
|
|
||||||
use lib $srcdir;
|
|
||||||
|
|
||||||
require 'psfonts.ph'; # The fonts we want to use
|
require 'psfonts.ph'; # The fonts we want to use
|
||||||
require 'pswidth.ph'; # PostScript string width
|
require 'pswidth.ph'; # PostScript string width
|
||||||
|
|
||||||
@@ -87,6 +84,9 @@ use Fcntl;
|
|||||||
'11x17' => [792,1224], # US double paper size
|
'11x17' => [792,1224], # US double paper size
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Canned header file
|
||||||
|
$headps = 'head.ps';
|
||||||
|
|
||||||
#
|
#
|
||||||
# Parse the command line
|
# Parse the command line
|
||||||
#
|
#
|
||||||
@@ -104,6 +104,8 @@ while ( $arg = shift(@ARGV) ) {
|
|||||||
$psconf{$parm} = shift(@ARGV);
|
$psconf{$parm} = shift(@ARGV);
|
||||||
} elsif ( $parm =~ /^(title|subtitle|year|author|license)$/ ) {
|
} elsif ( $parm =~ /^(title|subtitle|year|author|license)$/ ) {
|
||||||
$metadata{$parm} = shift(@ARGV);
|
$metadata{$parm} = shift(@ARGV);
|
||||||
|
} elsif ( $parm eq 'headps' ) {
|
||||||
|
$headps = shift(@ARGV);
|
||||||
} else {
|
} else {
|
||||||
die "$0: Unknown option: $arg\n";
|
die "$0: Unknown option: $arg\n";
|
||||||
}
|
}
|
||||||
@@ -1028,7 +1030,8 @@ foreach $fset ( @AllFonts ) {
|
|||||||
print "/bullet [",ps_string($charcode{'bullet'}),"] def\n";
|
print "/bullet [",ps_string($charcode{'bullet'}),"] def\n";
|
||||||
|
|
||||||
# Emit the canned PostScript prologue
|
# Emit the canned PostScript prologue
|
||||||
open(PSHEAD, "< head.ps");
|
open(PSHEAD, '<', $headps)
|
||||||
|
or die "$0: cannot open: $headps: $!\n";
|
||||||
while ( defined($line = <PSHEAD>) ) {
|
while ( defined($line = <PSHEAD>) ) {
|
||||||
print $line;
|
print $line;
|
||||||
}
|
}
|
||||||
|
@@ -1,64 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
## --------------------------------------------------------------------------
|
|
||||||
##
|
|
||||||
## Copyright 1996-2009 The NASM Authors - All Rights Reserved
|
|
||||||
## See the file AUTHORS included with the NASM distribution for
|
|
||||||
## the specific copyright holders.
|
|
||||||
##
|
|
||||||
## Redistribution and use in source and binary forms, with or without
|
|
||||||
## modification, are permitted provided that the following
|
|
||||||
## conditions are met:
|
|
||||||
##
|
|
||||||
## * Redistributions of source code must retain the above copyright
|
|
||||||
## notice, this list of conditions and the following disclaimer.
|
|
||||||
## * Redistributions in binary form must reproduce the above
|
|
||||||
## copyright notice, this list of conditions and the following
|
|
||||||
## disclaimer in the documentation and/or other materials provided
|
|
||||||
## with the distribution.
|
|
||||||
##
|
|
||||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
||||||
## CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
||||||
## INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
||||||
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
## NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
||||||
## EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
##
|
|
||||||
## --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#
|
|
||||||
# Runs the equivalent of the following command line:
|
|
||||||
#
|
|
||||||
# $(PERL) $(srcdir)/genps.pl -subtitle "version `cat ../version`" \
|
|
||||||
# nasmdoc.dip
|
|
||||||
#
|
|
||||||
# This is implemented as a Perl script since `cat ...` doesn't
|
|
||||||
# necessarily work on non-Unix systems.
|
|
||||||
#
|
|
||||||
|
|
||||||
use File::Spec;
|
|
||||||
use Fcntl;
|
|
||||||
use Env;
|
|
||||||
|
|
||||||
$perl = $ENV{PERL} || 'perl';
|
|
||||||
$srcdir = $ENV{srcdir} || File::Spec->curdir();
|
|
||||||
|
|
||||||
$versionfile = File::Spec->catfile($srcdir, File::Spec->updir(), 'version');
|
|
||||||
$genps = File::Spec->catfile($srcdir, 'genps.pl');
|
|
||||||
|
|
||||||
sysopen(VERSION, $versionfile, O_RDONLY)
|
|
||||||
or die "$0: cannot open $versionfile\n";
|
|
||||||
$version = <VERSION>;
|
|
||||||
chomp $version;
|
|
||||||
close(VERSION);
|
|
||||||
|
|
||||||
# \240 = no-break space, see @NASMEncoding in genps.pl.
|
|
||||||
# If we use a normal space, it breaks on 'doze platforms...
|
|
||||||
system($perl, $genps, '-subtitle', "version\240".$version,
|
|
||||||
@ARGV, 'nasmdoc.dip');
|
|
@@ -33,6 +33,7 @@
|
|||||||
\#
|
\#
|
||||||
\# Source code to NASM documentation
|
\# Source code to NASM documentation
|
||||||
\#
|
\#
|
||||||
|
|
||||||
\M{category}{Programming}
|
\M{category}{Programming}
|
||||||
\M{title}{NASM - The Netwide Assembler}
|
\M{title}{NASM - The Netwide Assembler}
|
||||||
\M{year}{1996-2016}
|
\M{year}{1996-2016}
|
||||||
@@ -45,6 +46,9 @@
|
|||||||
\M{infotitle}{The Netwide Assembler for x86}
|
\M{infotitle}{The Netwide Assembler for x86}
|
||||||
\M{epslogo}{nasmlogo.eps}
|
\M{epslogo}{nasmlogo.eps}
|
||||||
\M{logoyadj}{-72}
|
\M{logoyadj}{-72}
|
||||||
|
|
||||||
|
\& version.src
|
||||||
|
|
||||||
\IR{-D} \c{-D} option
|
\IR{-D} \c{-D} option
|
||||||
\IR{-E} \c{-E} option
|
\IR{-E} \c{-E} option
|
||||||
\IR{-F} \c{-F} option
|
\IR{-F} \c{-F} option
|
||||||
@@ -382,11 +386,6 @@ google for us!
|
|||||||
development}\i{daily development snapshots} of NASM are available from
|
development}\i{daily development snapshots} of NASM are available from
|
||||||
the official web site.
|
the official web site.
|
||||||
|
|
||||||
Announcements are posted to
|
|
||||||
\W{news:comp.lang.asm.x86}\i\c{comp.lang.asm.x86},
|
|
||||||
and to the web site
|
|
||||||
\W{http://www.freshmeat.net/}\c{http://www.freshmeat.net/}.
|
|
||||||
|
|
||||||
If you want information about the current development status, please
|
If you want information about the current development status, please
|
||||||
subscribe to the \i\c{nasm-devel} email list; see link from the
|
subscribe to the \i\c{nasm-devel} email list; see link from the
|
||||||
website.
|
website.
|
||||||
@@ -963,13 +962,21 @@ Enabled by default.
|
|||||||
form of jmp instruction becomes jmp short form.
|
form of jmp instruction becomes jmp short form.
|
||||||
Enabled by default.
|
Enabled by default.
|
||||||
|
|
||||||
|
\b \i\c{zext-reloc} warns that a relocation has been zero-extended due
|
||||||
|
to limitations in the output format.
|
||||||
|
|
||||||
|
\b \i\c\{ptr} warns about keywords used in other assemblers that might
|
||||||
|
indicate a mistake in the source code. Currently only the MASM
|
||||||
|
\c{PTR} keyword is recognized.
|
||||||
|
|
||||||
\b \i\c{error} causes warnings to be treated as errors. Disabled by
|
\b \i\c{error} causes warnings to be treated as errors. Disabled by
|
||||||
default.
|
default.
|
||||||
|
|
||||||
\b \i\c{all} is an alias for \e{all} suppressible warning classes (not
|
\b \i\c{all} is an alias for \e{all} suppressible warning classes (not
|
||||||
including \c{error}). Thus, \c{-w+all} enables all available warnings.
|
including \c{error}). Thus, \c{-w+all} enables all available warnings.
|
||||||
|
|
||||||
In addition, you can set warning classes across sections.
|
In addition, you can control warnings in the source code itself, using
|
||||||
|
the \i\c{[warning]} directive.
|
||||||
Warning classes may be enabled with \i\c{[warning +warning-name]},
|
Warning classes may be enabled with \i\c{[warning +warning-name]},
|
||||||
disabled with \i\c{[warning -warning-name]} or reset to their
|
disabled with \i\c{[warning -warning-name]} or reset to their
|
||||||
original value with \i\c{[warning *warning-name]}. No "user form"
|
original value with \i\c{[warning *warning-name]}. No "user form"
|
||||||
@@ -8246,4 +8253,3 @@ column shows the processor type in which the instruction was introduced and,
|
|||||||
\A{changelog} \i{NASM Version History}
|
\A{changelog} \i{NASM Version History}
|
||||||
|
|
||||||
\& changes.src
|
\& changes.src
|
||||||
|
|
||||||
|
50
doc/rdsrc.pl
50
doc/rdsrc.pl
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
## --------------------------------------------------------------------------
|
## --------------------------------------------------------------------------
|
||||||
##
|
##
|
||||||
## Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
## Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
## See the file AUTHORS included with the NASM distribution for
|
## See the file AUTHORS included with the NASM distribution for
|
||||||
## the specific copyright holders.
|
## the specific copyright holders.
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
## copyright notice, this list of conditions and the following
|
## copyright notice, this list of conditions and the following
|
||||||
## disclaimer in the documentation and/or other materials provided
|
## disclaimer in the documentation and/or other materials provided
|
||||||
## with the distribution.
|
## with the distribution.
|
||||||
##
|
##
|
||||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||||
## CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
## CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
## INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
## INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
@@ -116,12 +116,20 @@
|
|||||||
# \&{filename}
|
# \&{filename}
|
||||||
# Includes filename. Recursion is allowed.
|
# Includes filename. Recursion is allowed.
|
||||||
#
|
#
|
||||||
|
|
||||||
use IO::File;
|
use File::Spec;
|
||||||
|
|
||||||
|
@include_path = ();
|
||||||
|
|
||||||
$diag = 1, shift @ARGV if $ARGV[0] eq "-d";
|
$diag = 1, shift @ARGV if $ARGV[0] eq "-d";
|
||||||
|
while ($ARGV[0] =~ /^\-[Ii](.*)$/) {
|
||||||
|
push(@include_path, $1);
|
||||||
|
shift;
|
||||||
|
}
|
||||||
|
|
||||||
($out_format) = @ARGV;
|
$out_format = shift(@ARGV);
|
||||||
|
@files = @ARGV;
|
||||||
|
@files = ('-') unless(scalar(@files));
|
||||||
|
|
||||||
$| = 1;
|
$| = 1;
|
||||||
|
|
||||||
@@ -136,9 +144,8 @@ print "Reading input...";
|
|||||||
$pname = "para000000";
|
$pname = "para000000";
|
||||||
@pnames = @pflags = ();
|
@pnames = @pflags = ();
|
||||||
$para = undef;
|
$para = undef;
|
||||||
while (defined($_ = <STDIN>)) {
|
foreach $file (@files) {
|
||||||
$_ = &untabify($_);
|
&include($file);
|
||||||
&check_include($_);
|
|
||||||
}
|
}
|
||||||
&got_para($para);
|
&got_para($para);
|
||||||
print "done.\n";
|
print "done.\n";
|
||||||
@@ -205,8 +212,9 @@ sub untabify($) {
|
|||||||
}
|
}
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
sub check_include {
|
sub read_line {
|
||||||
local $_ = shift;
|
local $_ = shift;
|
||||||
|
$_ = &untabify($_);
|
||||||
if (/\\& (\S+)/) {
|
if (/\\& (\S+)/) {
|
||||||
&include($1);
|
&include($1);
|
||||||
} else {
|
} else {
|
||||||
@@ -226,11 +234,25 @@ sub get_para($_) {
|
|||||||
}
|
}
|
||||||
sub include {
|
sub include {
|
||||||
my $name = shift;
|
my $name = shift;
|
||||||
my $F = IO::File->new($name)
|
my $F;
|
||||||
or die "Cannot open $name: $!";
|
|
||||||
while (<$F>) {
|
if ($name eq '-') {
|
||||||
&check_include($_);
|
open($F, '<-'); # stdin
|
||||||
|
} else {
|
||||||
|
my $found = 0;
|
||||||
|
foreach my $idir ( File::Spec->curdir, @include_path ) {
|
||||||
|
my $fpath = File::Spec->catfile($idir, $name);
|
||||||
|
if (open($F, '<', $fpath)) {
|
||||||
|
$found = 1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
die "Cannot open $name: $!\n" unless ($found);
|
||||||
}
|
}
|
||||||
|
while (defined($_ = <$F>)) {
|
||||||
|
&read_line($_);
|
||||||
|
}
|
||||||
|
close($F);
|
||||||
}
|
}
|
||||||
sub got_para {
|
sub got_para {
|
||||||
local ($_) = @_;
|
local ($_) = @_;
|
||||||
@@ -1493,7 +1515,7 @@ sub add_item {
|
|||||||
#
|
#
|
||||||
sub write_dip {
|
sub write_dip {
|
||||||
open(PARAS, "> nasmdoc.dip");
|
open(PARAS, "> nasmdoc.dip");
|
||||||
foreach $k (keys(%metadata)) {
|
foreach $k (sort(keys(%metadata))) {
|
||||||
print PARAS 'meta :', $k, "\n";
|
print PARAS 'meta :', $k, "\n";
|
||||||
print PARAS $metadata{$k},"\n";
|
print PARAS $metadata{$k},"\n";
|
||||||
}
|
}
|
||||||
|
10
insns.dat
10
insns.dat
@@ -799,8 +799,10 @@ MFENCE void [ np 0f ae f0] X64,AMD
|
|||||||
MONITOR void [ 0f 01 c8] PRESCOTT
|
MONITOR void [ 0f 01 c8] PRESCOTT
|
||||||
MONITOR reg_eax,reg_ecx,reg_edx [---: 0f 01 c8] PRESCOTT,NOLONG,ND
|
MONITOR reg_eax,reg_ecx,reg_edx [---: 0f 01 c8] PRESCOTT,NOLONG,ND
|
||||||
MONITOR reg_rax,reg_ecx,reg_edx [---: 0f 01 c8] X64,ND
|
MONITOR reg_rax,reg_ecx,reg_edx [---: 0f 01 c8] X64,ND
|
||||||
MONITORX void [ 0f 01 fa] X64,AMD
|
MONITORX void [ 0f 01 fa] AMD
|
||||||
MONITORX reg_rax,reg_ecx,reg_edx [---: 0f 01 fa] X64,AMD,ND
|
MONITORX reg_rax,reg_ecx,reg_edx [---: 0f 01 fa] X64,AMD,ND
|
||||||
|
MONITORX reg_eax,reg_ecx,reg_edx [---: 0f 01 fa] AMD,ND
|
||||||
|
MONITORX reg_ax,reg_ecx,reg_edx [---: 0f 01 fa] AMD,ND
|
||||||
MOV mem,reg_sreg [mr: 8c /r] 8086,SW
|
MOV mem,reg_sreg [mr: 8c /r] 8086,SW
|
||||||
MOV reg16,reg_sreg [mr: o16 8c /r] 8086
|
MOV reg16,reg_sreg [mr: o16 8c /r] 8086
|
||||||
MOV reg32,reg_sreg [mr: o32 8c /r] 386
|
MOV reg32,reg_sreg [mr: o32 8c /r] 386
|
||||||
@@ -893,8 +895,8 @@ MUL rm32 [m: o32 f7 /4] 386
|
|||||||
MUL rm64 [m: o64 f7 /4] X64
|
MUL rm64 [m: o64 f7 /4] X64
|
||||||
MWAIT void [ 0f 01 c9] PRESCOTT
|
MWAIT void [ 0f 01 c9] PRESCOTT
|
||||||
MWAIT reg_eax,reg_ecx [--: 0f 01 c9] PRESCOTT,ND
|
MWAIT reg_eax,reg_ecx [--: 0f 01 c9] PRESCOTT,ND
|
||||||
MWAITX void [ 0f 01 fb] X64,AMD
|
MWAITX void [ 0f 01 fb] AMD
|
||||||
MWAITX reg_eax,reg_ecx [--: 0f 01 fb] X64,AMD,ND
|
MWAITX reg_eax,reg_ecx [--: 0f 01 fb] AMD,ND
|
||||||
NEG rm8 [m: hle f6 /3] 8086,LOCK
|
NEG rm8 [m: hle f6 /3] 8086,LOCK
|
||||||
NEG rm16 [m: hle o16 f7 /3] 8086,LOCK
|
NEG rm16 [m: hle o16 f7 /3] 8086,LOCK
|
||||||
NEG rm32 [m: hle o32 f7 /3] 386,LOCK
|
NEG rm32 [m: hle o32 f7 /3] 386,LOCK
|
||||||
@@ -5116,7 +5118,7 @@ WRPKRU void [ 0f 01 ef] X64,FUTURE
|
|||||||
CLFLUSHOPT mem [m: 66 0f ae /7] FUTURE
|
CLFLUSHOPT mem [m: 66 0f ae /7] FUTURE
|
||||||
|
|
||||||
; AMD Zen v1
|
; AMD Zen v1
|
||||||
CLZERO void [ 0f 01 fc] X64,FUTURE,AMD
|
CLZERO void [ 0f 01 fc] FUTURE,AMD
|
||||||
|
|
||||||
;# Systematic names for the hinting nop instructions
|
;# Systematic names for the hinting nop instructions
|
||||||
; These should be last in the file
|
; These should be last in the file
|
||||||
|
54
nasm.c
54
nasm.c
@@ -171,6 +171,7 @@ static const struct warning {
|
|||||||
{"hle", "invalid hle prefixes", true},
|
{"hle", "invalid hle prefixes", true},
|
||||||
{"bnd", "invalid bnd prefixes", true},
|
{"bnd", "invalid bnd prefixes", true},
|
||||||
{"zext-reloc", "relocation zero-extended to match output format", true},
|
{"zext-reloc", "relocation zero-extended to match output format", true},
|
||||||
|
{"ptr", "non-NASM keyword used in other assemblers", true},
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool want_usage;
|
static bool want_usage;
|
||||||
@@ -339,6 +340,7 @@ int main(int argc, char **argv)
|
|||||||
error_file = stderr;
|
error_file = stderr;
|
||||||
|
|
||||||
tolower_init();
|
tolower_init();
|
||||||
|
src_init();
|
||||||
|
|
||||||
offsets = raa_init();
|
offsets = raa_init();
|
||||||
forwrefs = saa_init((int32_t)sizeof(struct forwrefinfo));
|
forwrefs = saa_init((int32_t)sizeof(struct forwrefinfo));
|
||||||
@@ -399,7 +401,7 @@ int main(int argc, char **argv)
|
|||||||
preproc->cleanup(0);
|
preproc->cleanup(0);
|
||||||
} else if (operating_mode & OP_PREPROCESS) {
|
} else if (operating_mode & OP_PREPROCESS) {
|
||||||
char *line;
|
char *line;
|
||||||
char *file_name = NULL;
|
const char *file_name = NULL;
|
||||||
int32_t prior_linnum = 0;
|
int32_t prior_linnum = 0;
|
||||||
int lineinc = 0;
|
int lineinc = 0;
|
||||||
|
|
||||||
@@ -439,7 +441,6 @@ int main(int argc, char **argv)
|
|||||||
nasm_fputs(line, ofile);
|
nasm_fputs(line, ofile);
|
||||||
nasm_free(line);
|
nasm_free(line);
|
||||||
}
|
}
|
||||||
nasm_free(file_name);
|
|
||||||
preproc->cleanup(0);
|
preproc->cleanup(0);
|
||||||
if (ofile)
|
if (ofile)
|
||||||
fclose(ofile);
|
fclose(ofile);
|
||||||
@@ -479,9 +480,11 @@ int main(int argc, char **argv)
|
|||||||
ofmt->cleanup();
|
ofmt->cleanup();
|
||||||
cleanup_labels();
|
cleanup_labels();
|
||||||
fflush(ofile);
|
fflush(ofile);
|
||||||
if (ferror(ofile))
|
if (ferror(ofile)) {
|
||||||
nasm_error(ERR_NONFATAL|ERR_NOFILE,
|
nasm_error(ERR_NONFATAL|ERR_NOFILE,
|
||||||
"write error on output file `%s'", outname);
|
"write error on output file `%s'", outname);
|
||||||
|
terminate_after_phase = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ofile) {
|
if (ofile) {
|
||||||
@@ -502,6 +505,7 @@ int main(int argc, char **argv)
|
|||||||
saa_free(forwrefs);
|
saa_free(forwrefs);
|
||||||
eval_cleanup();
|
eval_cleanup();
|
||||||
stdscan_cleanup();
|
stdscan_cleanup();
|
||||||
|
src_free();
|
||||||
|
|
||||||
return terminate_after_phase;
|
return terminate_after_phase;
|
||||||
}
|
}
|
||||||
@@ -890,8 +894,7 @@ set_warning:
|
|||||||
for (i = 1; i <= ERR_WARN_MAX; i++)
|
for (i = 1; i <= ERR_WARN_MAX; i++)
|
||||||
warning_on_global[i] = !do_warn;
|
warning_on_global[i] = !do_warn;
|
||||||
} else {
|
} else {
|
||||||
nasm_error(ERR_NONFATAL | ERR_NOFILE | ERR_USAGE,
|
/* Ignore invalid warning names; forward compatibility */
|
||||||
"invalid warning `%s'", param);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1515,9 +1518,7 @@ static void assemble_file(char *fname, StrList **depend_ptr)
|
|||||||
warning_on[i] = warning_on_global[i];
|
warning_on[i] = warning_on_global[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
nasm_error(ERR_NONFATAL,
|
|
||||||
"invalid warning id in WARNING directive");
|
|
||||||
break;
|
break;
|
||||||
case D_CPU: /* [CPU] */
|
case D_CPU: /* [CPU] */
|
||||||
cpu = get_cpu(value);
|
cpu = get_cpu(value);
|
||||||
@@ -1869,19 +1870,18 @@ static enum directives getkw(char **directive, char **value)
|
|||||||
*/
|
*/
|
||||||
static void nasm_verror_gnu(int severity, const char *fmt, va_list ap)
|
static void nasm_verror_gnu(int severity, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
char *currentfile = NULL;
|
const char *currentfile = NULL;
|
||||||
int32_t lineno = 0;
|
int32_t lineno = 0;
|
||||||
|
|
||||||
if (is_suppressed_warning(severity))
|
if (is_suppressed_warning(severity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(severity & ERR_NOFILE))
|
if (!(severity & ERR_NOFILE))
|
||||||
src_get(&lineno, ¤tfile);
|
src_get(&lineno, ¤tfile);
|
||||||
|
|
||||||
if (!skip_this_pass(severity)) {
|
if (!skip_this_pass(severity)) {
|
||||||
if (currentfile) {
|
if (currentfile) {
|
||||||
fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno);
|
fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno);
|
||||||
nasm_free(currentfile);
|
|
||||||
} else {
|
} else {
|
||||||
fputs("nasm: ", error_file);
|
fputs("nasm: ", error_file);
|
||||||
}
|
}
|
||||||
@@ -1907,7 +1907,7 @@ static void nasm_verror_gnu(int severity, const char *fmt, va_list ap)
|
|||||||
*/
|
*/
|
||||||
static void nasm_verror_vc(int severity, const char *fmt, va_list ap)
|
static void nasm_verror_vc(int severity, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
char *currentfile = NULL;
|
const char *currentfile = NULL;
|
||||||
int32_t lineno = 0;
|
int32_t lineno = 0;
|
||||||
|
|
||||||
if (is_suppressed_warning(severity))
|
if (is_suppressed_warning(severity))
|
||||||
@@ -1919,7 +1919,6 @@ static void nasm_verror_vc(int severity, const char *fmt, va_list ap)
|
|||||||
if (!skip_this_pass(severity)) {
|
if (!skip_this_pass(severity)) {
|
||||||
if (currentfile) {
|
if (currentfile) {
|
||||||
fprintf(error_file, "%s(%"PRId32") : ", currentfile, lineno);
|
fprintf(error_file, "%s(%"PRId32") : ", currentfile, lineno);
|
||||||
nasm_free(currentfile);
|
|
||||||
} else {
|
} else {
|
||||||
fputs("nasm: ", error_file);
|
fputs("nasm: ", error_file);
|
||||||
}
|
}
|
||||||
@@ -1951,15 +1950,18 @@ static bool is_suppressed_warning(int severity)
|
|||||||
|
|
||||||
static bool skip_this_pass(int severity)
|
static bool skip_this_pass(int severity)
|
||||||
{
|
{
|
||||||
/* See if it's a pass-one only warning and we're not in pass one. */
|
/* See if it's a pass-specific warning which should be skipped. */
|
||||||
|
|
||||||
if ((severity & ERR_MASK) > ERR_WARNING)
|
if ((severity & ERR_MASK) > ERR_WARNING)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (((severity & ERR_PASS1) && pass0 != 1) ||
|
/*
|
||||||
((severity & ERR_PASS2) && pass0 != 2))
|
* passn is 1 on the very first pass only.
|
||||||
return true;
|
* pass0 is 2 on the code-generation (final) pass only.
|
||||||
|
* These are the passes we care about in this case.
|
||||||
return false;
|
*/
|
||||||
|
return (((severity & ERR_PASS1) && passn != 1) ||
|
||||||
|
((severity & ERR_PASS2) && pass0 != 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1998,14 +2000,22 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vsnprintf(msg, sizeof msg, fmt, args);
|
vsnprintf(msg, sizeof msg - 64, fmt, args);
|
||||||
|
if ((severity & (ERR_WARN_MASK|ERR_PP_LISTMACRO)) == ERR_WARN_MASK) {
|
||||||
|
char *p = strchr(msg, '\0');
|
||||||
|
snprintf(p, 64, " [-w+%s]", warnings[WARN_IDX(severity)].name);
|
||||||
|
}
|
||||||
|
|
||||||
if (!skip_this_pass(severity))
|
if (!skip_this_pass(severity))
|
||||||
fprintf(error_file, "%s%s\n", pfx, msg);
|
fprintf(error_file, "%s%s\n", pfx, msg);
|
||||||
|
|
||||||
|
/* Are we recursing from error_list_macros? */
|
||||||
|
if (severity & ERR_PP_LISTMACRO)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't suppress this with skip_this_pass(), or we don't get
|
* Don't suppress this with skip_this_pass(), or we don't get
|
||||||
* preprocessor warnings in the list file
|
* pass1 or preprocessor warnings in the list file
|
||||||
*/
|
*/
|
||||||
if ((severity & ERR_MASK) >= ERR_WARNING)
|
if ((severity & ERR_MASK) >= ERR_WARNING)
|
||||||
lfmt->error(severity, pfx, msg);
|
lfmt->error(severity, pfx, msg);
|
||||||
@@ -2013,6 +2023,8 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args)
|
|||||||
if (severity & ERR_USAGE)
|
if (severity & ERR_USAGE)
|
||||||
want_usage = true;
|
want_usage = true;
|
||||||
|
|
||||||
|
preproc->error_list_macros(severity);
|
||||||
|
|
||||||
switch (severity & ERR_MASK) {
|
switch (severity & ERR_MASK) {
|
||||||
case ERR_DEBUG:
|
case ERR_DEBUG:
|
||||||
/* no further action, by definition */
|
/* no further action, by definition */
|
||||||
|
4
nasm.h
4
nasm.h
@@ -342,6 +342,9 @@ struct preproc_ops {
|
|||||||
|
|
||||||
/* Include path from command line */
|
/* Include path from command line */
|
||||||
void (*include_path)(char *path);
|
void (*include_path)(char *path);
|
||||||
|
|
||||||
|
/* Unwind the macro stack when printing an error message */
|
||||||
|
void (*error_list_macros)(int severity);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct preproc_ops nasmpp;
|
extern const struct preproc_ops nasmpp;
|
||||||
@@ -421,6 +424,7 @@ enum ccode { /* condition code names */
|
|||||||
#define TFLAG_BRC_OPT (1 << 1) /* may or may not have braces. opmasks {k1} */
|
#define TFLAG_BRC_OPT (1 << 1) /* may or may not have braces. opmasks {k1} */
|
||||||
#define TFLAG_BRC_ANY (TFLAG_BRC | TFLAG_BRC_OPT)
|
#define TFLAG_BRC_ANY (TFLAG_BRC | TFLAG_BRC_OPT)
|
||||||
#define TFLAG_BRDCAST (1 << 2) /* broadcasting decorator */
|
#define TFLAG_BRDCAST (1 << 2) /* broadcasting decorator */
|
||||||
|
#define TFLAG_WARN (1 << 3) /* warning only, treat as ID */
|
||||||
|
|
||||||
static inline uint8_t get_cond_opcode(enum ccode c)
|
static inline uint8_t get_cond_opcode(enum ccode c)
|
||||||
{
|
{
|
||||||
|
20
nasmlib.h
20
nasmlib.h
@@ -106,6 +106,7 @@ static inline vefunc nasm_set_verror(vefunc ve)
|
|||||||
|
|
||||||
#define ERR_NO_SEVERITY 0x00000100 /* suppress printing severity */
|
#define ERR_NO_SEVERITY 0x00000100 /* suppress printing severity */
|
||||||
#define ERR_PP_PRECOND 0x00000200 /* for preprocessor use */
|
#define ERR_PP_PRECOND 0x00000200 /* for preprocessor use */
|
||||||
|
#define ERR_PP_LISTMACRO 0x00000400 /* from preproc->error_list_macros() */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These codes define specific types of suppressible warning.
|
* These codes define specific types of suppressible warning.
|
||||||
@@ -134,7 +135,8 @@ static inline vefunc nasm_set_verror(vefunc ve)
|
|||||||
#define ERR_WARN_HLE WARN(13) /* bad HLE prefixes */
|
#define ERR_WARN_HLE WARN(13) /* bad HLE prefixes */
|
||||||
#define ERR_WARN_BND WARN(14) /* bad BND prefixes */
|
#define ERR_WARN_BND WARN(14) /* bad BND prefixes */
|
||||||
#define ERR_WARN_ZEXTRELOC WARN(15) /* relocation zero-extended */
|
#define ERR_WARN_ZEXTRELOC WARN(15) /* relocation zero-extended */
|
||||||
#define ERR_WARN_MAX 15 /* the highest numbered one */
|
#define ERR_WARN_PTR WARN(16) /* not a NASM keyword */
|
||||||
|
#define ERR_WARN_MAX 16 /* the highest numbered one */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wrappers around malloc, realloc and free. nasm_malloc will
|
* Wrappers around malloc, realloc and free. nasm_malloc will
|
||||||
@@ -389,16 +391,24 @@ void fwriteaddr(uint64_t data, int size, FILE * fp);
|
|||||||
int bsi(const char *string, const char **array, int size);
|
int bsi(const char *string, const char **array, int size);
|
||||||
int bsii(const char *string, const char **array, int size);
|
int bsii(const char *string, const char **array, int size);
|
||||||
|
|
||||||
char *src_set_fname(char *newname);
|
/*
|
||||||
|
* These functions are used to keep track of the source code file and name.
|
||||||
|
*/
|
||||||
|
void src_init(void);
|
||||||
|
void src_free(void);
|
||||||
|
const char *src_set_fname(const char *newname);
|
||||||
|
const char *src_get_fname(void);
|
||||||
int32_t src_set_linnum(int32_t newline);
|
int32_t src_set_linnum(int32_t newline);
|
||||||
int32_t src_get_linnum(void);
|
int32_t src_get_linnum(void);
|
||||||
|
/* Can be used when there is no need for the old information */
|
||||||
|
void src_set(int32_t line, const char *filename);
|
||||||
/*
|
/*
|
||||||
* src_get may be used if you simply want to know the source file and line.
|
* src_get gets both the source file name and line.
|
||||||
* It is also used if you maintain private status about the source location
|
* It is also used if you maintain private status about the source location
|
||||||
* It return 0 if the information was the same as the last time you
|
* It return 0 if the information was the same as the last time you
|
||||||
* checked, -1 if the name changed and (new-old) if just the line changed.
|
* checked, -2 if the name changed and (new-old) if just the line changed.
|
||||||
*/
|
*/
|
||||||
int src_get(int32_t *xline, char **xname);
|
int32_t src_get(int32_t *xline, const char **xname);
|
||||||
|
|
||||||
char *nasm_strcat(const char *one, const char *two);
|
char *nasm_strcat(const char *one, const char *two);
|
||||||
|
|
||||||
|
@@ -479,44 +479,6 @@ int bsii(const char *string, const char **array, int size)
|
|||||||
return -1; /* we haven't got it :( */
|
return -1; /* we haven't got it :( */
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *file_name = NULL;
|
|
||||||
static int32_t line_number = 0;
|
|
||||||
|
|
||||||
char *src_set_fname(char *newname)
|
|
||||||
{
|
|
||||||
char *oldname = file_name;
|
|
||||||
file_name = newname;
|
|
||||||
return oldname;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t src_set_linnum(int32_t newline)
|
|
||||||
{
|
|
||||||
int32_t oldline = line_number;
|
|
||||||
line_number = newline;
|
|
||||||
return oldline;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t src_get_linnum(void)
|
|
||||||
{
|
|
||||||
return line_number;
|
|
||||||
}
|
|
||||||
|
|
||||||
int src_get(int32_t *xline, char **xname)
|
|
||||||
{
|
|
||||||
if (!file_name || !*xname || strcmp(*xname, file_name)) {
|
|
||||||
nasm_free(*xname);
|
|
||||||
*xname = file_name ? nasm_strdup(file_name) : NULL;
|
|
||||||
*xline = line_number;
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (*xline != line_number) {
|
|
||||||
int32_t tmp = line_number - *xline;
|
|
||||||
*xline = line_number;
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *nasm_strcat(const char *one, const char *two)
|
char *nasm_strcat(const char *one, const char *two)
|
||||||
{
|
{
|
||||||
char *rslt;
|
char *rslt;
|
||||||
|
128
nasmlib/srcfile.c
Normal file
128
nasmlib/srcfile.c
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
/* ----------------------------------------------------------------------- *
|
||||||
|
*
|
||||||
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
|
* the specific copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following
|
||||||
|
* conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||||
|
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* srcfile.c - keep track of the current position in the input stream
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "compiler.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include "nasmlib.h"
|
||||||
|
#include "hashtbl.h"
|
||||||
|
|
||||||
|
static const char *file_name = NULL;
|
||||||
|
static int32_t line_number = 0;
|
||||||
|
|
||||||
|
static struct hash_table filename_hash;
|
||||||
|
|
||||||
|
void src_init(void)
|
||||||
|
{
|
||||||
|
hash_init(&filename_hash, HASH_MEDIUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
void src_free(void)
|
||||||
|
{
|
||||||
|
struct hash_tbl_node *iter = NULL;
|
||||||
|
void *dp;
|
||||||
|
|
||||||
|
while ((dp = hash_iterate(&filename_hash, &iter, NULL)) != NULL)
|
||||||
|
nasm_free(dp);
|
||||||
|
|
||||||
|
hash_free(&filename_hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the current filename, returning the old one. The input
|
||||||
|
* filename is duplicated if needed.
|
||||||
|
*/
|
||||||
|
const char *src_set_fname(const char *newname)
|
||||||
|
{
|
||||||
|
struct hash_insert hi;
|
||||||
|
const char *oldname;
|
||||||
|
void **dp;
|
||||||
|
|
||||||
|
if (newname) {
|
||||||
|
dp = hash_find(&filename_hash, newname, &hi);
|
||||||
|
if (dp) {
|
||||||
|
newname = (const char *)(*dp);
|
||||||
|
} else {
|
||||||
|
newname = nasm_strdup(newname);
|
||||||
|
hash_add(&hi, newname, (void *)newname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oldname = file_name;
|
||||||
|
file_name = newname;
|
||||||
|
return oldname;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t src_set_linnum(int32_t newline)
|
||||||
|
{
|
||||||
|
int32_t oldline = line_number;
|
||||||
|
line_number = newline;
|
||||||
|
return oldline;
|
||||||
|
}
|
||||||
|
|
||||||
|
void src_set(int32_t line, const char *fname)
|
||||||
|
{
|
||||||
|
src_set_fname(fname);
|
||||||
|
src_set_linnum(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *src_get_fname(void)
|
||||||
|
{
|
||||||
|
return file_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t src_get_linnum(void)
|
||||||
|
{
|
||||||
|
return line_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t src_get(int32_t *xline, const char **xname)
|
||||||
|
{
|
||||||
|
const char *xn = *xname;
|
||||||
|
int32_t xl = *xline;
|
||||||
|
|
||||||
|
*xline = line_number;
|
||||||
|
*xname = file_name;
|
||||||
|
|
||||||
|
/* XXX: Is the strcmp() really needed here? */
|
||||||
|
if (!file_name || !xn || (xn != file_name && strcmp(xn, file_name)))
|
||||||
|
return -2;
|
||||||
|
else
|
||||||
|
return line_number - xl;
|
||||||
|
}
|
@@ -26,6 +26,8 @@
|
|||||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
!addincludedir "${objdir}/nsis"
|
||||||
|
!addincludedir "${srcdir}/nsis"
|
||||||
!include "version.nsh"
|
!include "version.nsh"
|
||||||
!include /nonfatal "arch.nsh"
|
!include /nonfatal "arch.nsh"
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ SetCompressor lzma
|
|||||||
|
|
||||||
;Name and file
|
;Name and file
|
||||||
Name "${PACKAGE_NAME}"
|
Name "${PACKAGE_NAME}"
|
||||||
OutFile "../${PACKAGE_SHORT_NAME}-installer-${ARCH}.exe"
|
OutFile "${objdir}/${PACKAGE_SHORT_NAME}-installer-${ARCH}.exe"
|
||||||
|
|
||||||
;Get installation folder from registry if available
|
;Get installation folder from registry if available
|
||||||
InstallDirRegKey HKCU "Software\${PRODUCT_SHORT_NAME}" ""
|
InstallDirRegKey HKCU "Software\${PRODUCT_SHORT_NAME}" ""
|
||||||
@@ -67,8 +69,8 @@ Var CmdFailed
|
|||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Interface Settings
|
;Interface Settings
|
||||||
Caption "${PACKAGE_SHORT_NAME} installation"
|
Caption "${PACKAGE_SHORT_NAME} installation"
|
||||||
Icon "nasm.ico"
|
Icon "${srcdir}/nsis/nasm.ico"
|
||||||
UninstallIcon "nasm-un.ico"
|
UninstallIcon "${srcdir}/nsis/nasm-un.ico"
|
||||||
|
|
||||||
!define MUI_ABORTWARNING
|
!define MUI_ABORTWARNING
|
||||||
|
|
||||||
@@ -98,10 +100,10 @@ UninstallIcon "nasm-un.ico"
|
|||||||
Section "NASM" SecNasm
|
Section "NASM" SecNasm
|
||||||
Sectionin RO
|
Sectionin RO
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
File "../LICENSE"
|
File "${srcdir}/LICENSE"
|
||||||
File "../nasm.exe"
|
File "${objdir}/nasm.exe"
|
||||||
File "../ndisasm.exe"
|
File "${objdir}/ndisasm.exe"
|
||||||
File "nasm.ico"
|
File "${srcdir}/nsis/nasm.ico"
|
||||||
|
|
||||||
;Store installation folder
|
;Store installation folder
|
||||||
WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}" "" $INSTDIR
|
WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}" "" $INSTDIR
|
||||||
@@ -137,27 +139,27 @@ skip:
|
|||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "RDOFF" SecRdoff
|
Section "RDOFF" SecRdoff
|
||||||
File "../rdoff/ldrdf.exe"
|
File "${objdir}/rdoff/ldrdf.exe"
|
||||||
File "../rdoff/rdf2bin.exe"
|
File "${objdir}/rdoff/rdf2bin.exe"
|
||||||
File "../rdoff/rdf2com.exe"
|
File "${objdir}/rdoff/rdf2com.exe"
|
||||||
File "../rdoff/rdf2ith.exe"
|
File "${objdir}/rdoff/rdf2ith.exe"
|
||||||
File "../rdoff/rdf2ihx.exe"
|
File "${objdir}/rdoff/rdf2ihx.exe"
|
||||||
File "../rdoff/rdf2srec.exe"
|
File "${objdir}/rdoff/rdf2srec.exe"
|
||||||
File "../rdoff/rdfdump.exe"
|
File "${objdir}/rdoff/rdfdump.exe"
|
||||||
File "../rdoff/rdflib.exe"
|
File "${objdir}/rdoff/rdflib.exe"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Manual" SecManual
|
Section "Manual" SecManual
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
File "../doc/nasmdoc.pdf"
|
File "${objdir}/doc/nasmdoc.pdf"
|
||||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Manual.lnk" "$INSTDIR\nasmdoc.pdf"
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Manual.lnk" "$INSTDIR\nasmdoc.pdf"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "VS8 integration" SecVS8
|
Section "VS8 integration" SecVS8
|
||||||
CreateDirectory "$INSTDIR\VSrules"
|
CreateDirectory "$INSTDIR\VSrules"
|
||||||
SetOutPath "$INSTDIR\VSrules"
|
SetOutPath "$INSTDIR\VSrules"
|
||||||
File "../contrib/VSrules/nasm.README"
|
File "${srcdir}/contrib/VSrules/nasm.README"
|
||||||
File "../contrib/VSrules/nasm.rules"
|
File "${srcdir}/contrib/VSrules/nasm.rules"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
@@ -285,16 +285,16 @@ static void cv8_cleanup(void)
|
|||||||
build_type_table(type_sect);
|
build_type_table(type_sect);
|
||||||
|
|
||||||
if (cv8_state.source_file.name != NULL)
|
if (cv8_state.source_file.name != NULL)
|
||||||
free(cv8_state.source_file.name);
|
nasm_free(cv8_state.source_file.name);
|
||||||
|
|
||||||
if (cv8_state.cwd != NULL)
|
if (cv8_state.cwd != NULL)
|
||||||
free(cv8_state.cwd);
|
nasm_free(cv8_state.cwd);
|
||||||
|
|
||||||
saa_free(cv8_state.lines);
|
saa_free(cv8_state.lines);
|
||||||
|
|
||||||
saa_rewind(cv8_state.symbols);
|
saa_rewind(cv8_state.symbols);
|
||||||
while ((sym = saa_rstruct(cv8_state.symbols)))
|
while ((sym = saa_rstruct(cv8_state.symbols)))
|
||||||
free(sym->name);
|
nasm_free(sym->name);
|
||||||
saa_free(cv8_state.symbols);
|
saa_free(cv8_state.symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -464,6 +464,8 @@ static int64_t add_reloc(struct section *sect, int32_t section,
|
|||||||
r->snum = raa_read(extsyms, section);
|
r->snum = raa_read(extsyms, section);
|
||||||
if (reltype == RL_BRANCH)
|
if (reltype == RL_BRANCH)
|
||||||
r->type = X86_64_RELOC_BRANCH;
|
r->type = X86_64_RELOC_BRANCH;
|
||||||
|
else if (reltype == GENERIC_RELOC_VANILLA)
|
||||||
|
adjust = -sect->size;
|
||||||
} else {
|
} else {
|
||||||
/* local */
|
/* local */
|
||||||
r->ext = 0;
|
r->ext = 0;
|
||||||
@@ -1320,6 +1322,8 @@ static void macho_write_section (void)
|
|||||||
l += sectstab[r->snum]->addr;
|
l += sectstab[r->snum]->addr;
|
||||||
if (r->pcrel)
|
if (r->pcrel)
|
||||||
l -= s->addr;
|
l -= s->addr;
|
||||||
|
} else if (r->pcrel && r->type == GENERIC_RELOC_VANILLA) {
|
||||||
|
l -= s->addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write new offset back */
|
/* write new offset back */
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2012 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -59,8 +59,7 @@ static int32_t nop_lineinc;
|
|||||||
|
|
||||||
static void nop_reset(char *file, int pass, StrList **deplist)
|
static void nop_reset(char *file, int pass, StrList **deplist)
|
||||||
{
|
{
|
||||||
src_set_fname(nasm_strdup(file));
|
src_set(0, file);
|
||||||
src_set_linnum(0);
|
|
||||||
nop_lineinc = 1;
|
nop_lineinc = 1;
|
||||||
nop_fp = fopen(file, "r");
|
nop_fp = fopen(file, "r");
|
||||||
|
|
||||||
@@ -120,9 +119,9 @@ static char *nop_getline(void)
|
|||||||
int li;
|
int li;
|
||||||
char *nm = nasm_malloc(strlen(buffer));
|
char *nm = nasm_malloc(strlen(buffer));
|
||||||
if (sscanf(buffer + 5, "%"PRId32"+%d %s", &ln, &li, nm) == 3) {
|
if (sscanf(buffer + 5, "%"PRId32"+%d %s", &ln, &li, nm) == 3) {
|
||||||
nasm_free(src_set_fname(nm));
|
src_set(ln, nm);
|
||||||
src_set_linnum(ln);
|
|
||||||
nop_lineinc = li;
|
nop_lineinc = li;
|
||||||
|
nasm_free(nm);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nasm_free(nm);
|
nasm_free(nm);
|
||||||
@@ -169,6 +168,11 @@ static void nop_include_path(char *path)
|
|||||||
(void)path;
|
(void)path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nop_error_list_macros(int severity)
|
||||||
|
{
|
||||||
|
(void)severity;
|
||||||
|
}
|
||||||
|
|
||||||
const struct preproc_ops preproc_nop = {
|
const struct preproc_ops preproc_nop = {
|
||||||
nop_reset,
|
nop_reset,
|
||||||
nop_getline,
|
nop_getline,
|
||||||
@@ -177,5 +181,6 @@ const struct preproc_ops preproc_nop = {
|
|||||||
nop_pre_define,
|
nop_pre_define,
|
||||||
nop_pre_undefine,
|
nop_pre_undefine,
|
||||||
nop_pre_include,
|
nop_pre_include,
|
||||||
nop_include_path
|
nop_include_path,
|
||||||
|
nop_error_list_macros,
|
||||||
};
|
};
|
||||||
|
66
preproc.c
66
preproc.c
@@ -154,6 +154,9 @@ struct MMacro {
|
|||||||
uint64_t unique;
|
uint64_t unique;
|
||||||
int lineno; /* Current line number on expansion */
|
int lineno; /* Current line number on expansion */
|
||||||
uint64_t condcnt; /* number of if blocks... */
|
uint64_t condcnt; /* number of if blocks... */
|
||||||
|
|
||||||
|
const char *fname; /* File where defined */
|
||||||
|
int32_t xline; /* First line in macro */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -267,7 +270,7 @@ struct Include {
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
Cond *conds;
|
Cond *conds;
|
||||||
Line *expansion;
|
Line *expansion;
|
||||||
char *fname;
|
const char *fname;
|
||||||
int lineno, lineinc;
|
int lineno, lineinc;
|
||||||
MMacro *mstk; /* stack of active macros/reps */
|
MMacro *mstk; /* stack of active macros/reps */
|
||||||
};
|
};
|
||||||
@@ -2517,7 +2520,7 @@ static int do_directive(Token * tline)
|
|||||||
/* -MG given but file not found */
|
/* -MG given but file not found */
|
||||||
nasm_free(inc);
|
nasm_free(inc);
|
||||||
} else {
|
} else {
|
||||||
inc->fname = src_set_fname(nasm_strdup(p));
|
inc->fname = src_set_fname(p);
|
||||||
inc->lineno = src_set_linnum(0);
|
inc->lineno = src_set_linnum(0);
|
||||||
inc->lineinc = 1;
|
inc->lineinc = 1;
|
||||||
inc->expansion = NULL;
|
inc->expansion = NULL;
|
||||||
@@ -2754,7 +2757,7 @@ issue_error:
|
|||||||
pp_directives[i]);
|
pp_directives[i]);
|
||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
}
|
}
|
||||||
defining = nasm_malloc(sizeof(MMacro));
|
defining = nasm_zalloc(sizeof(MMacro));
|
||||||
defining->max_depth =
|
defining->max_depth =
|
||||||
(i == PP_RMACRO) || (i == PP_IRMACRO) ? DEADMAN_LIMIT : 0;
|
(i == PP_RMACRO) || (i == PP_IRMACRO) ? DEADMAN_LIMIT : 0;
|
||||||
defining->casesense = (i == PP_MACRO) || (i == PP_RMACRO);
|
defining->casesense = (i == PP_MACRO) || (i == PP_RMACRO);
|
||||||
@@ -2764,6 +2767,8 @@ issue_error:
|
|||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
src_get(&defining->xline, &defining->fname);
|
||||||
|
|
||||||
mmac = (MMacro *) hash_findix(&mmacros, defining->name);
|
mmac = (MMacro *) hash_findix(&mmacros, defining->name);
|
||||||
while (mmac) {
|
while (mmac) {
|
||||||
if (!strcmp(mmac->name, defining->name) &&
|
if (!strcmp(mmac->name, defining->name) &&
|
||||||
@@ -3571,7 +3576,9 @@ issue_error:
|
|||||||
src_set_linnum(k);
|
src_set_linnum(k);
|
||||||
istk->lineinc = m;
|
istk->lineinc = m;
|
||||||
if (tline) {
|
if (tline) {
|
||||||
nasm_free(src_set_fname(detoken(tline, false)));
|
char *fname = detoken(tline, false);
|
||||||
|
src_set_fname(fname);
|
||||||
|
nasm_free(fname);
|
||||||
}
|
}
|
||||||
free_tlist(origline);
|
free_tlist(origline);
|
||||||
return DIRECTIVE_FOUND;
|
return DIRECTIVE_FOUND;
|
||||||
@@ -4128,12 +4135,10 @@ again:
|
|||||||
*/
|
*/
|
||||||
if (!m->expansion) {
|
if (!m->expansion) {
|
||||||
if (!strcmp("__FILE__", m->name)) {
|
if (!strcmp("__FILE__", m->name)) {
|
||||||
int32_t num = 0;
|
const char *file = src_get_fname();
|
||||||
char *file = NULL;
|
/* nasm_free(tline->text); here? */
|
||||||
src_get(&num, &file);
|
|
||||||
tline->text = nasm_quote(file, strlen(file));
|
tline->text = nasm_quote(file, strlen(file));
|
||||||
tline->type = TOK_STRING;
|
tline->type = TOK_STRING;
|
||||||
nasm_free(file);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp("__LINE__", m->name)) {
|
if (!strcmp("__LINE__", m->name)) {
|
||||||
@@ -4812,7 +4817,7 @@ static void pp_verror(int severity, const char *fmt, va_list arg)
|
|||||||
istk && istk->conds &&
|
istk && istk->conds &&
|
||||||
((severity & ERR_PP_PRECOND) ?
|
((severity & ERR_PP_PRECOND) ?
|
||||||
istk->conds->state == COND_NEVER :
|
istk->conds->state == COND_NEVER :
|
||||||
emitting(istk->conds->state)))
|
!emitting(istk->conds->state)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* get %macro name */
|
/* get %macro name */
|
||||||
@@ -4848,8 +4853,7 @@ pp_reset(char *file, int apass, StrList **deplist)
|
|||||||
istk->mstk = NULL;
|
istk->mstk = NULL;
|
||||||
istk->fp = fopen(file, "r");
|
istk->fp = fopen(file, "r");
|
||||||
istk->fname = NULL;
|
istk->fname = NULL;
|
||||||
src_set_fname(nasm_strdup(file));
|
src_set(0, file);
|
||||||
src_set_linnum(0);
|
|
||||||
istk->lineinc = 1;
|
istk->lineinc = 1;
|
||||||
if (!istk->fp)
|
if (!istk->fp)
|
||||||
nasm_fatal(ERR_NOFILE, "unable to open input file `%s'", file);
|
nasm_fatal(ERR_NOFILE, "unable to open input file `%s'", file);
|
||||||
@@ -5025,10 +5029,8 @@ static char *pp_getline(void)
|
|||||||
"expected `%%endif' before end of file");
|
"expected `%%endif' before end of file");
|
||||||
}
|
}
|
||||||
/* only set line and file name if there's a next node */
|
/* only set line and file name if there's a next node */
|
||||||
if (i->next) {
|
if (i->next)
|
||||||
src_set_linnum(i->lineno);
|
src_set(i->lineno, i->fname);
|
||||||
nasm_free(src_set_fname(nasm_strdup(i->fname)));
|
|
||||||
}
|
|
||||||
istk = i->next;
|
istk = i->next;
|
||||||
lfmt->downlevel(LIST_INCLUDE);
|
lfmt->downlevel(LIST_INCLUDE);
|
||||||
nasm_free(i);
|
nasm_free(i);
|
||||||
@@ -5139,12 +5141,11 @@ static void pp_cleanup(int pass)
|
|||||||
Include *i = istk;
|
Include *i = istk;
|
||||||
istk = istk->next;
|
istk = istk->next;
|
||||||
fclose(i->fp);
|
fclose(i->fp);
|
||||||
nasm_free(i->fname);
|
|
||||||
nasm_free(i);
|
nasm_free(i);
|
||||||
}
|
}
|
||||||
while (cstk)
|
while (cstk)
|
||||||
ctx_pop();
|
ctx_pop();
|
||||||
nasm_free(src_set_fname(NULL));
|
src_set_fname(NULL);
|
||||||
if (pass == 0) {
|
if (pass == 0) {
|
||||||
IncPath *i;
|
IncPath *i;
|
||||||
free_llist(predef);
|
free_llist(predef);
|
||||||
@@ -5253,6 +5254,34 @@ static void make_tok_num(Token * tok, int64_t val)
|
|||||||
tok->type = TOK_NUMBER;
|
tok->type = TOK_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pp_list_one_macro(MMacro *m, int severity)
|
||||||
|
{
|
||||||
|
if (!m)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* We need to print the next_active list in reverse order */
|
||||||
|
pp_list_one_macro(m->next_active, severity);
|
||||||
|
|
||||||
|
if (m->name && !m->nolist) {
|
||||||
|
src_set(m->xline + m->lineno, m->fname);
|
||||||
|
nasm_error(severity, "... from macro `%s' defined here", m->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pp_error_list_macros(int severity)
|
||||||
|
{
|
||||||
|
int32_t saved_line;
|
||||||
|
const char *saved_fname = NULL;
|
||||||
|
|
||||||
|
severity |= ERR_PP_LISTMACRO | ERR_NO_SEVERITY;
|
||||||
|
src_get(&saved_line, &saved_fname);
|
||||||
|
|
||||||
|
if (istk)
|
||||||
|
pp_list_one_macro(istk->mstk, severity);
|
||||||
|
|
||||||
|
src_set(saved_line, saved_fname);
|
||||||
|
}
|
||||||
|
|
||||||
const struct preproc_ops nasmpp = {
|
const struct preproc_ops nasmpp = {
|
||||||
pp_reset,
|
pp_reset,
|
||||||
pp_getline,
|
pp_getline,
|
||||||
@@ -5261,5 +5290,6 @@ const struct preproc_ops nasmpp = {
|
|||||||
pp_pre_define,
|
pp_pre_define,
|
||||||
pp_pre_undefine,
|
pp_pre_undefine,
|
||||||
pp_pre_include,
|
pp_pre_include,
|
||||||
pp_include_path
|
pp_include_path,
|
||||||
|
pp_error_list_macros,
|
||||||
};
|
};
|
||||||
|
5
quote.c
5
quote.c
@@ -42,9 +42,10 @@
|
|||||||
#include "nasmlib.h"
|
#include "nasmlib.h"
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
|
|
||||||
char *nasm_quote(char *str, size_t len)
|
char *nasm_quote(const char *str, size_t len)
|
||||||
{
|
{
|
||||||
char c, c1, *p, *q, *nstr, *ep;
|
const char *p, *ep;
|
||||||
|
char c, c1, *q, *nstr;
|
||||||
unsigned char uc;
|
unsigned char uc;
|
||||||
bool sq_ok, dq_ok;
|
bool sq_ok, dq_ok;
|
||||||
size_t qlen;
|
size_t qlen;
|
||||||
|
2
quote.h
2
quote.h
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
|
||||||
char *nasm_quote(char *str, size_t len);
|
char *nasm_quote(const char *str, size_t len);
|
||||||
size_t nasm_unquote(char *str, char **endptr);
|
size_t nasm_unquote(char *str, char **endptr);
|
||||||
char *nasm_skip_string(char *str);
|
char *nasm_skip_string(char *str);
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ datarootdir = @datarootdir@
|
|||||||
CC = @CC@
|
CC = @CC@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
BUILD_CFLAGS = $(CFLAGS) @DEFS@
|
BUILD_CFLAGS = $(CFLAGS) @DEFS@
|
||||||
INTERNAL_CFLAGS = -I$(srcdir) -I$(top_srcdir)
|
INTERNAL_CFLAGS = -I$(srcdir) -I$(top_srcdir) -I..
|
||||||
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
|
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -113,7 +113,7 @@ static int stdscan_handle_brace(struct tokenval *tv)
|
|||||||
if (!(tv->t_flag & TFLAG_BRC_ANY)) {
|
if (!(tv->t_flag & TFLAG_BRC_ANY)) {
|
||||||
/* invalid token is put inside braces */
|
/* invalid token is put inside braces */
|
||||||
nasm_error(ERR_NONFATAL,
|
nasm_error(ERR_NONFATAL,
|
||||||
"%s is not a valid decorator with braces", tv->t_charptr);
|
"`%s' is not a valid decorator with braces", tv->t_charptr);
|
||||||
tv->t_type = TOKEN_INVALID;
|
tv->t_type = TOKEN_INVALID;
|
||||||
} else if (tv->t_flag & TFLAG_BRC_OPT) {
|
} else if (tv->t_flag & TFLAG_BRC_OPT) {
|
||||||
if (is_reg_class(OPMASKREG, tv->t_integer)) {
|
if (is_reg_class(OPMASKREG, tv->t_integer)) {
|
||||||
@@ -166,6 +166,11 @@ int stdscan(void *private_data, struct tokenval *tv)
|
|||||||
* is it actually a register or instruction name, or what? */
|
* is it actually a register or instruction name, or what? */
|
||||||
token_type = nasm_token_hash(ourcopy, tv);
|
token_type = nasm_token_hash(ourcopy, tv);
|
||||||
|
|
||||||
|
if (unlikely(tv->t_flag & TFLAG_WARN)) {
|
||||||
|
nasm_error(ERR_WARNING|ERR_PASS1|ERR_WARN_PTR,
|
||||||
|
"`%s' is not a NASM keyword", tv->t_charptr);
|
||||||
|
}
|
||||||
|
|
||||||
if (likely(!(tv->t_flag & TFLAG_BRC))) {
|
if (likely(!(tv->t_flag & TFLAG_BRC))) {
|
||||||
/* most of the tokens fall into this case */
|
/* most of the tokens fall into this case */
|
||||||
return token_type;
|
return token_type;
|
||||||
|
12
test/macroerr.asm
Normal file
12
test/macroerr.asm
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
%include "macroerr.inc"
|
||||||
|
|
||||||
|
%macro bluttan 1
|
||||||
|
mov eax,%1
|
||||||
|
blej %1
|
||||||
|
%endmacro
|
||||||
|
|
||||||
|
bluttan ptr
|
||||||
|
blej ptr
|
||||||
|
dd ptr, ptr
|
||||||
|
|
||||||
|
ptr:
|
3
test/macroerr.inc
Normal file
3
test/macroerr.inc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
%macro blej 1
|
||||||
|
mov eax,%1
|
||||||
|
%endmacro
|
4
test/ptr.asm
Normal file
4
test/ptr.asm
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
;; This should warn but still assemble, as the code is correct
|
||||||
|
|
||||||
|
mov eax,dword ptr
|
||||||
|
ptr:
|
@@ -1,6 +1,6 @@
|
|||||||
## --------------------------------------------------------------------------
|
## --------------------------------------------------------------------------
|
||||||
##
|
##
|
||||||
## Copyright 1996-2013 The NASM Authors - All Rights Reserved
|
## Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
## See the file AUTHORS included with the NASM distribution for
|
## See the file AUTHORS included with the NASM distribution for
|
||||||
## the specific copyright holders.
|
## the specific copyright holders.
|
||||||
##
|
##
|
||||||
@@ -76,6 +76,9 @@ word
|
|||||||
yword
|
yword
|
||||||
zword
|
zword
|
||||||
|
|
||||||
|
% TOKEN_ID, 0, TFLAG_WARN, 0
|
||||||
|
ptr
|
||||||
|
|
||||||
% TOKEN_FLOAT, 0, 0, 0
|
% TOKEN_FLOAT, 0, 0, 0
|
||||||
__infinity__
|
__infinity__
|
||||||
__nan__
|
__nan__
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
## --------------------------------------------------------------------------
|
## --------------------------------------------------------------------------
|
||||||
##
|
##
|
||||||
## Copyright 1996-2009 The NASM Authors - All Rights Reserved
|
## Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
## See the file AUTHORS included with the NASM distribution for
|
## See the file AUTHORS included with the NASM distribution for
|
||||||
## the specific copyright holders.
|
## the specific copyright holders.
|
||||||
##
|
##
|
||||||
@@ -178,6 +178,9 @@ if ( $what eq 'h' ) {
|
|||||||
print $nasm_id, "\n"; # Print ID in decimal
|
print $nasm_id, "\n"; # Print ID in decimal
|
||||||
} elsif ( $what eq 'xid' ) {
|
} elsif ( $what eq 'xid' ) {
|
||||||
printf "0x%08x\n", $nasm_id; # Print ID in hexadecimal
|
printf "0x%08x\n", $nasm_id; # Print ID in hexadecimal
|
||||||
|
} elsif ( $what eq 'docsrc' ) {
|
||||||
|
printf "\\M{version}{%s}\n", $line;
|
||||||
|
printf "\\M{subtitle}{version %s}\n", $line;
|
||||||
} else {
|
} else {
|
||||||
die "$0: Unknown output: $what\n";
|
die "$0: Unknown output: $what\n";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user