diff --git a/.gitignore b/.gitignore index 267007b7..14eccf95 100644 --- a/.gitignore +++ b/.gitignore @@ -14,11 +14,13 @@ *.pdb *.rej *.s +*.si *.swp *.xml .*swo *~ \#* +.\#* *.bak *.tmp .git-ignore @@ -54,6 +56,7 @@ TAGS /macros/macros.c /nasm /ndisasm +/nasm.spec /nsis/arch.nsh /nsis/version.nsh /rdoff/Makefile diff --git a/Makefile.in b/Makefile.in index f5505a67..71783af4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -100,7 +100,8 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \ nasmlib/crc64.$(O) nasmlib/malloc.$(O) \ nasmlib/md5c.$(O) nasmlib/string.$(O) \ nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \ - nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) \ + nasmlib/realpath.$(O) nasmlib/path.$(O) \ + nasmlib/filename.$(O) nasmlib/srcfile.$(O) \ nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \ nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \ nasmlib/raa.$(O) nasmlib/saa.$(O) \ @@ -348,6 +349,7 @@ clean: $(RM_F) nasm-*-installer-*.exe $(RM_F) tags TAGS $(RM_F) nsis/arch.nsh + $(RM_F) perlbreq.si $(RM_F) $(RDFPROGS) $(RDF2BINLINKS) distclean: clean @@ -417,8 +419,16 @@ tar: dist spec: nasm.spec -nasm.spec: nasm.spec.in version.sed - sed -f version.sed < nasm.spec.in > nasm.spec +ALLPERLSRC := $(shell find $(srcdir) -type f -name '*.p[lh]') + +perlbreq.si: $(ALLPERLSRC) + sed -n -r -e 's/^use[[:space:]]+([^[:space:];]+).*$$/BuildRequires: perl(\1)/p' $(ALLPERLSRC) | \ + sed -r -e '/perl\((strict|warnings)\)/d' | \ + sort | uniq > perlbreq.si || ( rm -f perlbreq.si ; false ) + +nasm.spec: nasm.spec.in nasm.spec.sed version.sed perlbreq.si + sed -f version.sed -f nasm.spec.sed \ + < nasm.spec.in > nasm.spec || ( rm -f nasm.spec ; false ) splint: splint -weak *.c @@ -619,6 +629,9 @@ nasmlib/md5c.$(O): nasmlib/md5c.c config/config.h config/msvc.h \ nasmlib/mmap.$(O): nasmlib/mmap.c config/config.h config/msvc.h \ config/unknown.h config/watcom.h include/compiler.h include/error.h \ include/nasmint.h include/nasmlib.h nasmlib/file.h +nasmlib/path.$(O): nasmlib/path.c config/config.h config/msvc.h \ + config/unknown.h config/watcom.h include/compiler.h include/error.h \ + include/nasmint.h include/nasmlib.h nasmlib/perfhash.$(O): nasmlib/perfhash.c config/config.h config/msvc.h \ config/unknown.h config/watcom.h include/compiler.h include/hashtbl.h \ include/nasmint.h include/nasmlib.h include/perfhash.h diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak index 25915136..b8b6d3ad 100644 --- a/Mkfiles/msvc.mak +++ b/Mkfiles/msvc.mak @@ -73,7 +73,8 @@ LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) \ nasmlib\crc64.$(O) nasmlib\malloc.$(O) \ nasmlib\md5c.$(O) nasmlib\string.$(O) \ nasmlib\file.$(O) nasmlib\mmap.$(O) nasmlib\ilog2.$(O) \ - nasmlib\realpath.$(O) nasmlib\filename.$(O) nasmlib\srcfile.$(O) \ + nasmlib\realpath.$(O) nasmlib\path.$(O) \ + nasmlib\filename.$(O) nasmlib\srcfile.$(O) \ nasmlib\zerobuf.$(O) nasmlib\readnum.$(O) nasmlib\bsi.$(O) \ nasmlib\rbtree.$(O) nasmlib\hashtbl.$(O) \ nasmlib\raa.$(O) nasmlib\saa.$(O) \ @@ -519,6 +520,9 @@ nasmlib\md5c.$(O): nasmlib\md5c.c config\msvc.h config\unknown.h \ nasmlib\mmap.$(O): nasmlib\mmap.c config\msvc.h config\unknown.h \ config\watcom.h include\compiler.h include\error.h include\nasmint.h \ include\nasmlib.h nasmlib\file.h +nasmlib\path.$(O): nasmlib\path.c config\msvc.h config\unknown.h \ + config\watcom.h include\compiler.h include\error.h include\nasmint.h \ + include\nasmlib.h nasmlib\perfhash.$(O): nasmlib\perfhash.c config\msvc.h config\unknown.h \ config\watcom.h include\compiler.h include\hashtbl.h include\nasmint.h \ include\nasmlib.h include\perfhash.h diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index 88d4afcc..516c3f03 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -59,7 +59,8 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) & nasmlib/crc64.$(O) nasmlib/malloc.$(O) & nasmlib/md5c.$(O) nasmlib/string.$(O) & nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) & - nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) & + nasmlib/realpath.$(O) nasmlib/path.$(O) & + nasmlib/filename.$(O) nasmlib/srcfile.$(O) & nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) & nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) & nasmlib/raa.$(O) nasmlib/saa.$(O) & @@ -493,6 +494,9 @@ nasmlib/md5c.$(O): nasmlib/md5c.c config/msvc.h config/unknown.h & nasmlib/mmap.$(O): nasmlib/mmap.c config/msvc.h config/unknown.h & config/watcom.h include/compiler.h include/error.h include/nasmint.h & include/nasmlib.h nasmlib/file.h +nasmlib/path.$(O): nasmlib/path.c config/msvc.h config/unknown.h & + config/watcom.h include/compiler.h include/error.h include/nasmint.h & + include/nasmlib.h nasmlib/perfhash.$(O): nasmlib/perfhash.c config/msvc.h config/unknown.h & config/watcom.h include/compiler.h include/hashtbl.h include/nasmint.h & include/nasmlib.h include/perfhash.h diff --git a/aclocal.m4 b/aclocal.m4 index 5d278448..f216e511 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -9,10 +9,10 @@ AC_DEFUN(PA_ADD_CFLAGS, CFLAGS="$CFLAGS $1" AC_TRY_LINK(AC_INCLUDES_DEFAULT, [printf("Hello, World!\n");], - AC_MSG_RESULT([yes]) - CFLAGS="$pa_add_cflags__old_cflags ifelse([$2],[],[$1],[$2])", - AC_MSG_RESULT([no]) - CFLAGS="$pa_add_cflags__old_cflags")]) + [AC_MSG_RESULT([yes]) + CFLAGS="$pa_add_cflags__old_cflags ifelse([$2],[],[$1],[$2])"], + [AC_MSG_RESULT([no]) + CFLAGS="$pa_add_cflags__old_cflags"])]) dnl -------------------------------------------------------------------------- dnl PA_ADD_CLDFLAGS() @@ -28,12 +28,12 @@ AC_DEFUN(PA_ADD_CLDFLAGS, LDFLAGS="$LDFLAGS $1" AC_TRY_LINK(AC_INCLUDES_DEFAULT, [printf("Hello, World!\n");], - AC_MSG_RESULT([yes]) - CFLAGS="$pa_add_cldflags__old_cflags ifelse([$2],[],[$1],[$2])" - LDFLAGS="$pa_add_cldflags__old_ldflags ifelse([$2],[],[$1],[$2])", - AC_MSG_RESULT([no]) - CFLAGS="$pa_add_cldflags__old_cflags" - LDFLAGS="$pa_add_cldflags__old_ldflags")]) + [AC_MSG_RESULT([yes]) + CFLAGS="$pa_add_cldflags__old_cflags ifelse([$2],[],[$1],[$2])" + LDFLAGS="$pa_add_cldflags__old_ldflags ifelse([$2],[],[$1],[$2])"], + [AC_MSG_RESULT([no]) + CFLAGS="$pa_add_cldflags__old_cflags" + LDFLAGS="$pa_add_cldflags__old_ldflags"])]) dnl -------------------------------------------------------------------------- dnl PA_VAR @@ -137,15 +137,13 @@ dnl Simpler-to-use versions of AC_ARG_ENABLED, that include the dnl test for $enableval and the AS_HELP_STRING definition dnl -------------------------------------------------------------------------- AC_DEFUN(PA_ARG_ENABLED, -[AC_ARG_ENABLE([$1], - [AS_HELP_STRING([--enable-$1],[$2])], [], [enableval=no]) - AS_IF([test x"$enableval" != xno], [$3], [$4]) +[AC_ARG_ENABLE([$1], [AS_HELP_STRING([--enable-$1],[$2])], [], [enableval=no]) + AS_IF([test x"$enableval" != xno], [$3], [$4]) ]) AC_DEFUN(PA_ARG_DISABLED, -[AC_ARG_ENABLE([$1], - [AS_HELP_STRING([--disable-$1],[$2])], [], [enableval=yes]) - AS_IF([test x"$enableval" = xno], [$3], [$4]) +[AC_ARG_ENABLE([$1],[AS_HELP_STRING([--disable-$1],[$2])], [], [enableval=yes]) + AS_IF([test x"$enableval" = xno], [$3], [$4]) ]) dnl -------------------------------------------------------------------------- diff --git a/asm/assemble.c b/asm/assemble.c index 9c76b0ea..31db516a 100644 --- a/asm/assemble.c +++ b/asm/assemble.c @@ -2426,13 +2426,11 @@ static enum match_result matches(const struct itemplate *itemp, * - offset can fit in a byte when EVEX is not used * - offset can be compressed when EVEX is used */ -#define IS_MOD_01() (input->eaflags & EAF_BYTEOFFS || \ - (o >= -128 && o <= 127 && \ - seg == NO_SEG && !forw_ref && \ - !(input->eaflags & EAF_WORDOFFS) && \ - !(ins->rex & REX_EV)) || \ - (ins->rex & REX_EV && \ - is_disp8n(input, ins, &output->disp8))) +#define IS_MOD_01() (!(input->eaflags & EAF_WORDOFFS) && \ + (ins->rex & REX_EV ? seg == NO_SEG && !forw_ref && \ + is_disp8n(input, ins, &output->disp8) : \ + input->eaflags & EAF_BYTEOFFS || (o >= -128 && \ + o <= 127 && seg == NO_SEG && !forw_ref))) static enum ea_type process_ea(operand *input, ea *output, int bits, int rfield, opflags_t rflags, insn *ins, diff --git a/asm/labels.c b/asm/labels.c index 8c2223a0..1183151c 100644 --- a/asm/labels.c +++ b/asm/labels.c @@ -186,7 +186,7 @@ static union label *find_label(const char *label, int create, int *created) /* * must allocate a new block */ - lfree->admin.next = (union label *)nasm_malloc(LBLK_SIZE); + lfree->admin.next = nasm_malloc(LBLK_SIZE); lfree = lfree->admin.next; init_block(lfree); } @@ -424,11 +424,11 @@ int init_labels(void) { hash_init(<ab, HASH_LARGE); - ldata = lfree = (union label *)nasm_malloc(LBLK_SIZE); + ldata = lfree = nasm_malloc(LBLK_SIZE); init_block(lfree); perm_head = perm_tail = - (struct permts *)nasm_malloc(sizeof(struct permts)); + nasm_malloc(sizeof(struct permts)); perm_head->next = NULL; perm_head->size = PERMTS_SIZE; @@ -483,7 +483,7 @@ static char *perm_copy(const char *string) if (perm_tail->size - perm_tail->usage < len) { perm_tail->next = - (struct permts *)nasm_malloc(sizeof(struct permts)); + nasm_malloc(sizeof(struct permts)); perm_tail = perm_tail->next; perm_tail->next = NULL; perm_tail->size = PERMTS_SIZE; diff --git a/configure.ac b/configure.ac index 1905e8dd..8ee20798 100644 --- a/configure.ac +++ b/configure.ac @@ -208,8 +208,9 @@ dnl support function sections dnl PA_ARG_ENABLED([sections], [compile with function/data section support], - [PA_ADD_CFLAGS([-ffunction-sections]), - PA_ADD_CFLAGS([-fdata-sections])], + [PA_ADD_CLDFLAGS([-ffunction-sections]) + PA_ADD_CLDFLAGS([-fdata-sections]) + PA_ADD_CLDFLAGS([-Wl,--gc-sections])], []) dnl dnl support LTO diff --git a/doc/nasmdoc.css b/doc/nasmdoc.css index af095273..f989f37b 100644 --- a/doc/nasmdoc.css +++ b/doc/nasmdoc.css @@ -61,11 +61,26 @@ ul.index { color: inherit; } } +@media only screen and (min-width: 90em) { + /* For a very wide screen, go to a columnar layout */ + div.contents { + -webkit-column-count: 2; + -moz-column-count: 2; + column-count: 2; + } +} +@media only screen and (min-width: 135em) { + div.contents { + -webkit-column-count: 3; + -moz-column-count: 3; + column-count: 3; + } +} @media screen { /* Setting an explicit margin to keep the navbar from moving */ body { padding: 0; - margin: 10px; + margin: 8px; } /* Link styles */ @@ -94,7 +109,7 @@ ul.index { ul.navbar { display: block; position: sticky; - top: 10px; + top: 8px; width: 100%; margin: 0; padding: 0; diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 79eb59d0..361b8f3b 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -791,31 +791,30 @@ disable it by \c{-w-orphan-labels}. The current \i{warning classes} are: \b \i\c{other} specifies any warning not otherwise specified in any -class. +class. Enabled by default. \b \i\c{macro-params} covers warnings about \i{multi-line macros} -being invoked with the wrong number of parameters. This warning -class is enabled by default; see \k{mlmacover} for an example of why +being invoked with the wrong number of parameters. Enabled by default; +see \k{mlmacover} for an example of why you might want to disable it. + +\b \i\c{macro-selfref} warns if a macro references itself. Disabled by +default. + +\b \i\c{macro-defaults} warns when a macro has more default parameters +than optional parameters. Enabled by default; see \k{mlmacdef} for why you might want to disable it. -\b \i\c{macro-selfref} warns if a macro references itself. This -warning class is disabled by default. - -\b\i\c{macro-defaults} warns when a macro has more default -parameters than optional parameters. This warning class -is enabled by default; see \k{mlmacdef} for why you might want to disable it. - \b \i\c{orphan-labels} covers warnings about source lines which contain no instruction but define a label without a trailing colon. NASM warns about this somewhat obscure condition by default; see \k{syntax} for more information. \b \i\c{number-overflow} covers warnings about numeric constants which -don't fit in 64 bits. This warning class is enabled by default. +don't fit in 64 bits. Enabled by default. \b \i\c{gnu-elf-extensions} warns if 8-bit or 16-bit relocations are used in \c{-f elf} format. The GNU extensions allow this. -This warning class is disabled by default. +Disabled by default. \b \i\c{float-overflow} warns about floating point overflow. Enabled by default. @@ -844,11 +843,11 @@ form of jmp instruction becomes jmp short form. Enabled by default. \b \i\c{zext-reloc} warns that a relocation has been zero-extended due -to limitations in the output format. +to limitations in the output format. Enabled by default. \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. +\c{PTR} keyword is recognized. Enabled by default. \b \i\c{bad-pragma} warns about a malformed or otherwise unparsable \c{%pragma} directive. Disabled by default. @@ -862,22 +861,24 @@ implemented. Disabled by default. \b \i\c{unknown-warning} warns about a \c{-w} or \c{-W} option or a \c{[WARNING]} directive that contains an unknown warning name or is -otherwise not possible to process. +otherwise not possible to process. Disabled by default. \b \i\c{all} is an alias for \e{all} suppressible warning classes. Thus, \c{-w+all} enables all available warnings, and \c{-w-all} disables warnings entirely (since NASM 2.13). -Since version 2.00, NASM has also supported the gcc-like syntax +Since version 2.00, NASM has also supported the \c{gcc}-like syntax \c{-Wwarning-class} and \c{-Wno-warning-class} instead of \c{-w+warning-class} and \c{-w-warning-class}, respectively; both syntaxes work identically. The option \c{-w+error} or \i\c{-Werror} can be used to treat warnings as errors. This can be controlled on a per warning class basis -(\c{-w+error=}\e{warning-class}); if no \e{warning-class} is specified -NASM treats it as \c{-w+error=all}; the same applies to \c{-w-error} -or \i\c{-Wno-error}, of course. +(\c{-w+error=}\e{warning-class} or \c{-Werror=}\e{warning-class}); +if no \e{warning-class} is specified NASM treats it as +\c{-w+error=all}; the same applies to \c{-w-error} or +\i\c{-Wno-error}, +of course. In addition, you can control warnings in the source code itself, using the \i\c{[WARNING]} directive. See \k{asmdir-warning}. @@ -4678,9 +4679,15 @@ The \c{[WARNING]} directive can be used to enable or disable classes of warnings in the same way as the \c{-w} option, see \k{opt-w} for more details about warning classes. -Warning classes may be enabled with \c{[warning +]\e{warning-class}\c{]}, disabled -with \c{[warning -}\e{warning-class}\c{]}, or reset to their original value (as -specified on the command line) with \c{[warning *}\e{warning-class}{]}. +\b \c{[warning +}\e{warning-class}\c{]} enables warnings for + \e{warning-class}. + +\b \c{[warning -}\e{warning-class}\c{]} disables warnings for + \e{warning-class}. + +\b \c{[warning *}\e{warning-class}\c{]} restores \e{warning-class} to + the original value, either the default value or as specified on the + command line. The \c{[WARNING]} directive also accepts the \c{all}, \c{error} and \c{error=}\e{warning-class} specifiers. @@ -7754,9 +7761,10 @@ a zero-extended absolute displacement can access from 0 to 4 GB. \H{unix64} Interfacing to 64-bit C Programs (Unix) -On Unix, the 64-bit ABI is defined by the document: +On Unix, the 64-bit ABI as well as the x32 ABI (32-bit ABI with the +CPU in 64-bit mode) is defined by the documents at: -\W{http://www.nasm.us/links/unix64abi}\c{http://www.nasm.us/links/unix64abi} +\W{http://www.nasm.us/abi/unix64}\c{http://www.nasm.us/abi/unix64} Although written for AT&T-syntax assembly, the concepts apply equally well for NASM-style assembly. What follows is a simplified summary. @@ -7786,9 +7794,9 @@ Integer and SSE register arguments are counted separately, so for the case of \H{win64} Interfacing to 64-bit C Programs (Win64) -The Win64 ABI is described at: +The Win64 ABI is described by the document at: -\W{http://www.nasm.us/links/win64abi}\c{http://www.nasm.us/links/win64abi} +\W{http://www.nasm.us/abi/win64}\c{http://www.nasm.us/abi/win64} What follows is a simplified summary. diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl index bc066584..129bb085 100644 --- a/doc/rdsrc.pl +++ b/doc/rdsrc.pl @@ -971,11 +971,12 @@ sub html_preamble { print "