summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* release: don't include nasmdoc.pdf.xz in the -xdoc fileH. Peter Anvin (Intel)2020-06-041-1/+2
| | | | | | | There is no reason to include both nasmdoc.pdf.xz and nasmdoc.pdf. For the -xdoc file, the one with minimal dependencies is the proper one. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* nasm.spec.in: need perl; .pdf.xz now build by standard MakefileH. Peter Anvin (Intel)2020-06-041-2/+2
| | | | | | | | | Building NASM from scratch needs perl. .pdf.xz is now build by the standard NASM Makefile.in, so don't do it again (it causes failures.) Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* NASM 2.15rc3nasm-2.15rc3H. Peter Anvin (Intel)2020-06-041-1/+1
|
* BR 3392662: handle empty argument at end of mmacro callH. Peter Anvin (Intel)2020-06-041-3/+10
| | | | | | | | | | | A trailing comma at the end of an mmacro call is an empty argument, and so we can't terminate the argument-processing loop. The only case where skip_white() returning NULL where we are allowed to terminate the loop is in the case of nparams == 0, i.e. the macro call has no arguments at all. Reported-by: gabriele balducci <balducci@units.it> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* nasm.c: correctly print errors once committed; assert errhold_stack emptyH. Peter Anvin (Intel)2020-06-041-5/+10
| | | | | | | | | | Properly format the error messages when we print them (oops!) The errhold_stack should be empty after each pass. It may even be worthwhile to make sure it is empty after each *line*, but do this for now. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* preproc: don't call nasm_error_hold_push() twiceH. Peter Anvin (Intel)2020-06-041-1/+0
| | | | | | | We must not call nasm_error_hold_push() twice... the obvious leak of the error stack caused all kinds of errors to be suppressed. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* BR 3392652: hold smacro expansion warnings until we are sureH. Peter Anvin (Intel)2020-06-044-37/+157
| | | | | | | | Don't issue smacro expansion warnings until we are sure we are actually *done* with the smacro expansion. The last pass of expand_smacro_noreset() gets to commit warnings. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* asm/error.c: handle warning "all" correctlyH. Peter Anvin (Intel)2020-06-041-2/+6
| | | | | | | | warning_alias[0] is "all". It is represented in the loop by value == NULL; WARN_IDX_ALL does not have an entry in warning_state[] and so trying to poke it is an error. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* NASM 2.15rc2nasm-2.15rc2H. Peter Anvin2020-06-011-1/+1
|
* outobj: fix harmless but still incorrect use of uninitialized variableH. Peter Anvin2020-06-011-3/+3
| | | | | | | Fix use of uninitialized variable. This most likely is just an issue while running at debug level >= 3, but it's still wrong. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* BR 3392674: fix handling of {ud1,ud2b} <reg>,<reg>H. Peter Anvin2020-06-011-6/+6
| | | | | | | | We need the instruction table to contain the correct information for both the reg and the rm field in the various modes. Reported-by: <fasdfqwer@mail.com> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* BR 3392667: more reasonable limit for expression descentH. Peter Anvin (Intel)2020-06-018-5/+113
| | | | | | | | Set an expression descent limit to 8192, which is more reasonable to expect to work on most platforms. Furthermore, if getrlimit() exists, then try to use it to see if we need to further limit the size. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* preproc: error out if an include file exists but can't be openedH. Peter Anvin (Intel)2020-06-013-6/+12
| | | | | | | | | | If an include file exists, but cannot be opened, that is still a critical error. However, downgrade this from a fatal to a nonfatal error. There really isn't any reason to stop cold here. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* BR 3392669: in expand_one_smacro(), we may reach EOL before tafterH. Peter Anvin (Intel)2020-06-012-1/+1
| | | | | | | | | If the rest of the line is consumed, we may never see tafter, so we have to test for end of line at line 5412. We already do at 5397, so it clearly should have been there all along. Reported-by: <puppet@zju.edu.cn> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* BR 3392668: in %define, don't set "definining" until confirmedH. Peter Anvin (Intel)2020-06-011-6/+11
| | | | | | | | | | | | | | | Don't set "defining" until the macro definition is successfully parsed and we know for sure that we are going to define the macro. Together with: a762cd4e5402a360 BR 3392668: preproc: test for macro in TOK_LOCAL_SYMBOL ... this addresses BR 3392668. Reported-by: <puppet@zju.edu.cn> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* BR 3392668: preproc: test for macro in TOK_LOCAL_SYMBOLH. Peter Anvin (Intel)2020-06-012-3/+15
| | | | | | | | | | TOK_LOCAL_SYMBOL is only applicable inside a macro; otherwise error out just like we do for TOK_MMACRO_PARAM. This *partially* addresses BR 3392668. Reported-by: <puppet@zju.edu.cn> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* Makefile portability improvement, build nasmdoc.pdf.xzH. Peter Anvin (Intel)2020-05-264-35/+135
| | | | | | | | Significantly improve the portability/reliability of a general make command. Build a .pdf.xz version of the documentation, using an uncompressed pdf as basis. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* NASM 2.15rc1nasm-2.15rc1H. Peter Anvin (Intel)2020-05-261-1/+1
|
* Merge remote-tracking branch 'chang/master'H. Peter Anvin (Intel)2020-05-260-0/+0
|\
| * test: Add BR 3392607Chang S. Bae2020-04-011-0/+2
| | | | | | | | | | | | Reported-by: Henrik Gramner <herik@gramner.com> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392607 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * insns.dat: Fix the opcodes for the AVX512-VBMI2 instructionsHenrik Gramner2020-04-011-18/+18
| | | | | | | | | | | | | | | | | | The two VPSH{R|L}DV* instructions had the wrong opcode. Reported-by: Henrik Gramner <herik@gramner.com> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392607 Signed-off-by: Henrik Gramner <henrik@gramner.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * disam: explicitly change stdin to binary modeChang S. Bae2020-04-014-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The binary mode has no difference from text mode in POSIX-compliant operating systems. The two modes are distinguishable from each other on Windows, and perhaps on other systems as well. The binary stream has scalability and other advantages. Windows treats the standard input stream as text mode by default. So the code changes it to binary mode. Also, add a helper function, nasm_set_binary_mode(), that is OS-agnostic, in the library. Reported-by: Didier Stevens <didier.stevens@gmail.com> Suggested-by: Didier Stevens <didier.stevens@gmail.com> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392649 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * test: Add BR 3392640Chang S. Bae2020-04-011-0/+4
| | | | | | | | | | | | Suggested-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392640 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * preproc: Fix the token in expanding the %+/%- macro-parametersChang S. Bae2020-04-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The code looked to be unintentionally always nullifying the token pointer at first place in handling those macro-parameters. Remove it to avoid segfault. Fixes: de7acc3a46cb ("preproc: defer %00, %? and %?? expansion for nested macros, cleanups") Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392640 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * test: Add BR 3392630Chang S. Bae2020-04-011-1/+5
| | | | | | | | | | | | | | | | Add the test code into the existing xdefine testing. Suggested-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392630 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * preproc: Fix the token iterator in expanding single-line macroChang S. Bae2020-04-011-1/+3
| | | | | | | | | | | | | | | | | | | | The code used to stuck in going through whitespace tokens. Fix to increment towards on the next in the loop. Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392630 Suggested-by: C. Masloch <pushbx@ulukai.org> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * test: Add BR 3392626Chang S. Bae2020-04-011-0/+6
| | | | | | | | | | | | | | | | | | | | | | There are many similar preprocessor loop cases but located on each bug-report basis. While it looks to be better to consolidate them together, add one more test case like what was done before. Suggested-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392626 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
| * preproc: Fix to reset %rep list line number after every iterationChang S. Bae2020-04-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The code has been fixed to print the corresponding line numbers of %rep blocks correctly, but only for the first iteration. For the subsequent iterations, the current line number on the expansion needs to be explicitly reset again. Fixes: ab6f8319552f ("listing: when listing lines in macros and rep blocks, show the actual line") Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392626 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | doc: Update for upcoming 2.15 releasenasm-2.15.xx-preAndrey Matyukov2020-05-063-23/+206
| | | | | | | | | | | | | | Update release notes and documentation for 2.15 Signed-off-by: Andrey Matyukov <andrey.matyukov@intel.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | test: Add BR3392607Chang S. Bae2020-04-221-0/+2
| | | | | | | | | | | | Reported-by: Henrik Gramner <herik@gramner.com> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392607 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | insns.dat: Fix the opcodes for the AVX512-VBMI2 instructionsHenrik Gramner2020-04-221-18/+18
| | | | | | | | | | | | | | | | | | The two VPSH{R|L}DV* instructions had the wrong opcode. Reported-by: Henrik Gramner <herik@gramner.com> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392607 Signed-off-by: Henrik Gramner <henrik@gramner.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | disam: explicitly change stdin to binary modeChang S. Bae2020-04-224-1/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The binary mode has no difference from text mode in POSIX-compliant operating systems. The two modes are distinguishable from each other on Windows, and perhaps on other systems as well. The binary stream has scalability and other advantages. Windows treats the standard input stream as text mode by default. So the code changes it to binary mode. Also, add a helper function, nasm_set_binary_mode(), that is OS-agnostic, in the library. Reported-by: Didier Stevens <didier.stevens@gmail.com> Suggested-by: Didier Stevens <didier.stevens@gmail.com> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392649 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | test: Add BR3392661Chang S. Bae2020-04-221-0/+8
| | | | | | | | | | | | Suggested-by: <mae.bdf@outlook.com> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392661 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | outelf: Fix the section index for the debug outputChang S. Bae2020-04-221-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The section information delivered to the debug output has an index of the section table. The index should be different from the total number of sections at the moment, the returned value from add_sectname(). So, fix the value. Fixes: b2004511ddde ("ELF: handle more than 32,633 sections") Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392654 Reported-by: <mae.bdf@outlook.com> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392661 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | preproc: Fix in accessing the definition structure of a single-line macroChang S. Bae2020-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Determining whether we should warn on defining a single-line macro, with a name and a certain number of parameters, call a helper function, smacro_defined(). It does not always return the address of the definition structure. Fix the code to be cautiously accessing the definition structure. Fixes: e91f5cc1322e ("preproc: fix %undef of macro aliases, and add %ifdefalias") Reported-by: Dale Curtis <dalecurtis@chromium.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392659 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | test: Add BR3392660Chang S. Bae2020-04-211-0/+9
| | | | | | | | | | | | Suggested-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392660 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | preproc: Fix the macro-parameter check for conditional codeChang S. Bae2020-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Mistreating the macro-parameter, just equivalent to the given argument number, leads to casting an unnecessary error. Fix to assemble the conditional code correctly. Fixes: de7acc3a46cb ("preproc: defer %00, %? and %?? expansion for nested macros, cleanups") Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392660 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | test: Add BR3392640Chang S. Bae2020-04-211-0/+4
| | | | | | | | | | | | Suggested-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392640 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | preproc: Fix the token in expanding the macro-parametersChang S. Bae2020-04-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The code looked to be unintentionally always nullifying the token pointer at first place in handling those macro-parameters. Remove it to avoid segfault. Fixes: de7acc3a46cb ("preproc: defer %00, %? and %?? expansion for nested macros, cleanups") Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392640 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | test: Add BR3392630Chang S. Bae2020-04-211-1/+5
| | | | | | | | | | | | | | | | Add the test code into the existing xdefine testing. Suggested-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392630 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | preproc: Fix the token iterator in expanding single-line macroChang S. Bae2020-04-211-1/+3
| | | | | | | | | | | | | | | | | | | | The code used to stuck in going through whitespace tokens. Fix to increment towards on the next in the loop. Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392630 Suggested-by: C. Masloch <pushbx@ulukai.org> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | test: Add BR3392626Chang S. Bae2020-04-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | There are many similar preprocessor loop cases but located on each bug-report basis. While it looks to be better to consolidate them together, add one more test case like what was done before. Suggested-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392626 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | preproc: Fix to reset %rep list line number after every iterationChang S. Bae2020-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The code has been fixed to print the corresponding line numbers of %rep blocks correctly, but only for the first iteration. For the subsequent iterations, the current line number on the expansion needs to be explicitly reset again. Fixes: ab6f8319552f ("listing: when listing lines in macros and rep blocks, show the actual line") Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392626 Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
* | test: test case for BR 3392655, overflow during bin format linkH. Peter Anvin2020-03-311-0/+37
|/ | | | | | | The bin format linker should warn if a relocation overflows its virtual address. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* preproc: fix %undef of macro aliases, and add %ifdefaliasH. Peter Anvin (Intel)2019-10-233-35/+90
| | | | | | | | | | | Macro aliases can legitimately point to nonexistent macros. Furthermore, %undef should remove the pointed-at macro, not the alias. This led to an infinite loop in the existing code; fix that. Add an %ifdefalias directive to test for the existence of an alias. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* listing: make it possible to flush the listing output after every lineH. Peter Anvin (Intel)2019-10-234-3/+27
| | | | | | | Add the -Lw option to flush the list file after every line output. This is handy for debugging if nasm hangs. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* preproc: properly protect %xdefine params (see below), cleanupsH. Peter Anvin (Intel)2019-10-233-73/+119
| | | | | | | | | | | | | | | | | | 1. %xdefine was broken because the code used i as a loop, which is a standard use for the name i. To avoid that confusion in the future, use "op" rather than "i" to hold the directive constant. 2. Once (1) was fixed, the smacro expansion code would fail because of parameter token numbers being indistinguishable between the ongoing expansion and the %xdefine parameters. In a first pass, mark the parameters with a new TOK_XDEF_PARAM token number, and change them to proper parameter token numbers in a second pass, which is now moved into define_smacro() which is where it arguably belongs. 3. Add a few tests for token pasting and xdefine with and without parameters. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* preproc: reserve space for terminal NUL in %strcatH. Peter Anvin (Intel)2019-10-171-1/+1
| | | | | | | | | | Technically, this is not necessary, because make_tok_qstr_len() doesn't rely on NUL termination, and in fact it *can't*, since the string might contain embedded NULs, but tacking on a NUL is good for debugging if nothing else. That means reserving space for it! Reported-by: C. Masloch <pushbx@ulukai.org> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* preproc: fix %strcat and %substrH. Peter Anvin (Intel)2019-10-161-4/+9
| | | | | | | | | | | | Fix incorrectly running off the end of the intended string for %strcat and %substr. This is a modified version of a patch contributed by C. Masloch. Reported-by: C. Masloch <pushbx@ulukai.org> Originally-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392599#c11 Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
* preproc: %xdefine must process arguments before expandingH. Peter Anvin (Intel)2019-10-161-4/+12
| | | | | | | | | | | | | | The only way in which %xdefine(xxx) yyyy zzzz differs from %define(xxx) yyyy %[zzzz] is that in the former case macro arguments get preserved, even if they are macros defined elsewhere. Revert to that behavior. Reported-by: C. Masloch <pushbx@ulukai.org> Link: https://bugzilla.nasm.us/show_bug.cgi?id=3392623 Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>