summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | NASM 2.14rc4nasm-2.14rc4H. Peter Anvin2018-06-141-1/+1
| |
* | labels: allocation of a segment number counts as a changeH. Peter Anvin2018-06-141-5/+2
| | | | | | | | | | | | | | | | If we allocate a new segment number, that has to cause global_offset_changed to be incremented. Thus, we should not update lptr->defn.segment until that would ordinarily be done. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Don't keep assigning segment numbers to EXTERN or COMMONH. Peter Anvin2018-06-142-3/+7
| | | | | | | | | | | | | | | | | | If a symbol is EXTERN or COMMON, then we should not keep assigning it new segment numbers over and over. Instead, change the label code so that it assignes a new segment value if and only if one has not been assigned before. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | NASM 2.14rc3nasm-2.14rc3H. Peter Anvin2018-06-141-1/+1
| |
* | outmacho: don't do encoding magic in the segment indexH. Peter Anvin2018-06-141-49/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Encoding magic (in this case, subsection number) by bitfields in the segment index has several problems: 1. It limits the number of *external symbols* as well as segments/subsections. 2. It is inefficient for the assembler (creates a very large RAA). This is also a really good opportunity for removing linear lookups in the MachO backend. We now use an RAA to do look up segment by index, and a hash table to look up segment by name. Subsections are simply handled by allocating a new index using seg_alloc() but still point it to the same section structure in the index RAA. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | labels: add a subsection field available for backend useH. Peter Anvin2018-06-145-17/+34
| | | | | | | | | | | | | | Allow the subsection to store a subsection value directly in the label, rather than having to do strange encoding hacks. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | segalloc: DO NOT reset segment numbersH. Peter Anvin2018-06-143-21/+0
| | | | | | | | | | | | | | | | | | | | We are not supposed to reset the segment numbers; this was an attempted fix for a convergence bug that didn't actually exist. The backend is required to return the same segment number for the same segment; if it does not, the front end will not converge, but that is in fact the correct behavior. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | RAA: add functions for storing pointers in RAA'sH. Peter Anvin2018-06-142-20/+54
| | | | | | | | | | | | | | | | | | | | RAAs can, and should be, usable for storing pointers as well as integers. In reality it is exactly the same code, but make it explicit by having different entry points. In the actual RAA the data is stored as a union, which in practice will not occupy any more space than the existing code. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | NASM 2.14rc2nasm-2.14rc2H. Peter Anvin2018-06-121-1/+1
| |
* | Fix parsing of long options; actually warn on bad limitH. Peter Anvin2018-06-121-9/+22
| | | | | | | | | | | | | | | | | | Fix the parsing of long options (arguments with = broke things.) Actually issue a warning if we specify a wrong limit on the command line. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Make any execution limit configurable, add eval limitH. Peter Anvin2018-06-1210-101/+255
| | | | | | | | | | | | | | Make any "deadman"-style execution limit configurable on the command line (--limit-foo) or via a pragma (%pragma limit foo). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | NASM 2.14rc1nasm-2.14rc1H. Peter Anvin2018-06-111-1/+1
| |
* | Unbreak special segment symbols, unbreak COMMONH. Peter Anvin2018-06-115-22/+52
| | | | | | | | | | | | | | | | | | | | | | | | Recent changes broke: 1. Backend-provided special segments, due to seg_alloc() getting reset. 2. COMMON; the old code would pass size in the "offset" *without* setting it in the label structure. Containing all this information in the label structure requires another field. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Add --pragma and --before option; make --include = -PH. Peter Anvin2018-06-114-39/+91
| | | | | | | | | | | | | | | | Add --pragma to add pragmas on the command line; --before option to add *any* statement on the command line, and add --include as an alias for -P for familiarity with other toolchains. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | directive: Make cpu directive case insensitive back againCyrill Gorcunov2018-06-071-1/+1
|/ | | | | | | | | | During code suffle we occasionally made cpu directive to take letter case into account despite the documentation. https://bugzilla.nasm.us/show_bug.cgi?id=3392491 Reported-by: Rebecca Cran <rebecca@bluestop.org> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* asm/directiv.c: fix bug in perm_alloc()H. Peter Anvin2018-06-012-4/+14
| | | | | | Fix dumb thinko in perm_alloc(). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* macho: Turn off OFMT_KEEP_ADDRH. Peter Anvin2018-06-011-2/+2
| | | | | | | | | OFMT_KEEP_ADDR seems to not work properly. Now when we have proper subsections, there is no need for that anymore. This reverts commit 69ed82447a13a22e52a86a51a5657c7955a6767b. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Cleanup of label renaming infrastructure, add subsection supportH. Peter Anvin2018-06-0121-522/+500
| | | | | | | | | | | | | | In order to support Mach-O better, add support for subsections, as used by Mach-O "subsections_via_symbols". We also want to add infrastructure to support this by downcalling to the backend to indicate if a new subsection is needed. Currently this supports a maximum of 2^14 subsections per section for Mach-O; this can be addressed by adding a level of indirection (or cleaning up the handling of sections so we have an actual data structure.) Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* test: add test for subsections via symbolsH. Peter Anvin2018-05-301-4/+2
| | | | | | Add a test for subsections via symbols. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Add support for backend-defined subsections and label hacksH. Peter Anvin2018-05-3018-32/+203
| | | | | | | | | | MachO has this odd thing called "subsections via symbols", by which a symbol can magically start what effectively is a new section. To support this, add support for a calldown into the backend when a new symbol is defined *at the current output location*, and allow it to switch the current segment. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* pragma.c: make the generic "output" and "debug" pragma namespaces workH. Peter Anvin2018-05-302-2/+52
| | | | | | | "output" and "debug" are supposed to redirect to the current output and debug formats. Fix it so it actually does. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* configure.ac: add -fvisibility=hidden if supportedH. Peter Anvin2018-05-301-0/+6
| | | | | | | | None of our symbols are available for a dynamic library, and if they were, there would be no point in allowing them to be overridden. This optimizes code generation for global symbols. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* malloc: simplify nasm_malloc code, add nasm_strcatn()H. Peter Anvin2018-05-305-22/+85
| | | | | | | | | | | | | | Simplify the nasm_malloc() code by moving the pointer check into a common subroutine. We can now issue a filename error even for failures like malloc(). Add support for the gcc sentinel attribute (verify that a list ends with NULL). Add a handful of safe_alloc attributes. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Revert "output: macho -- Check the actual size of 64-bit absolute address"H. Peter Anvin2018-05-081-2/+1
| | | | This reverts commit 69ed82447a13a22e52a86a51a5657c7955a6767b.
* Fix implicit fallthrough that trips -WerrorH. Peter Anvin2018-05-082-2/+6
| | | | | | | -Werror now trips on implicit fallthroughs. There is also at least one that probably should not be, although it appears to be harmless. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* assemble: Check global line limitChang S. Bae2018-05-051-1/+6
| | | | | | | | | | | | Without the limit, the while loop opens to semi-infinite that will exhaustively consume the heap space. Also, the index value gets into the garbage. https://bugzilla.nasm.us/show_bug.cgi?id=3392474 Reported-by : Dongliang Mu <mudongliangabcd@gmail.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: macho -- Avoid conversion of addresses to RAWDATAChang S. Bae2018-05-053-10/+15
| | | | | | | | | | | | Without relocation, the linker may do erroneous dead strip. For the relocation, the conversion of addresses to RAWDATA should be avoided for Mach-O. https://bugzilla.nasm.us/show_bug.cgi?id=3392469 Reported-by: Andrew Fish <afish@apple.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: macho -- Check the actual size of 64-bit absolute addressChang S. Bae2018-05-051-1/+2
| | | | | | | | | | | | | | | Even though the size is set to 64-bit, actual value can be in 32-bit range. In that case, the use of such absolute address is prevented. The side effect of 58d2ab17 is resolved. https://bugzilla.nasm.us/show_bug.cgi?id=3392468 Reported-by: Richard Russell <rtrussell@gmail.com> Reported-by: Michael Petch <mpetch@capp-sysware.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: codeview -- change version number writtenFabian Giesen2018-04-201-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows Store and Xbox One apps need to pass WACK, the Windows App Certification Kit, and part of that process involves a tool named BinScope that checks the debug info of all object files making up the final executable against a list of minimum versions. These minimum versions get increased periodically as new SDKs and compilers are released. In a patch 2 years ago, I made NASM pretend it was MASM and output a then-current MASM version number. Well, the minimum version number has increased again, and periodically hardcoding a new random MASM version to keep BinScope happy doesn't seem like the way to go. It turns out that BinScope does not impose any minimum version requirements on object files listing a source language BinScope doesn't know about. I have no idea how to officially request a new CodeView language ID (or whether there even is a way to do so for someone outside MS). But experimentally, using 'N' (0x4e) for NASM seems to be working just fine and is far away from the range of currently allocated language IDs (which stop at 0x10). Long story short, make NASM emit a source language ID of 0x4e, with the actual NASM version in the version number fields. BinScope is happy to accept that, and since the language ID field is purely an informational field in an optional debug info record that (as far as I can tell) is not used for anything else, this seems reasonably safe and unlikely to cause trouble. Signed-off-by: Fabian Giesen <fabiang@radgametools.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Revert "compiler: Add fallthrough() helper"Cyrill Gorcunov2018-02-253-40/+0
| | | | This reverts commit 8ba28e13ea4453a587d08e5533e60f4ff2b4781a.
* Revert "Use fallthrough() to placate compiler"Cyrill Gorcunov2018-02-252-3/+1
| | | | This reverts commit 8a7c6009fbddd7084fdfaebd9e3e3fd0baa39bc2.
* Revert "aclocal.m4: Use Werror in PA_CHECK_FALLTHROUGH_ATTRIBUTE"Cyrill Gorcunov2018-02-251-1/+0
| | | | This reverts commit 8b211a0a3b87999ffe38d03ba1e01639bfc05db0.
* aclocal.m4: Use Werror in PA_CHECK_FALLTHROUGH_ATTRIBUTECyrill Gorcunov2018-02-251-0/+1
| | | | | | | In sake of https://bugzilla.nasm.us/show_bug.cgi?id=3392465 Suggested-by: Ozkan Sezer <sezeroz@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* insns.dat: Update UD0 encoding to fit the specificationCyrill Gorcunov2018-02-251-1/+4
| | | | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: macho -- Add support for N_PEXT in macho outputMatthieu Darbois2018-02-251-5/+36
| | | | | | | | This allows to mark global symbols as private external. Similar to visibility hidden in ELF output. Signed-off-by: Matthieu Darbois <mayeut@users.noreply.github.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* Use fallthrough() to placate compilerCyrill Gorcunov2018-02-252-1/+3
| | | | | | | https://bugzilla.nasm.us/show_bug.cgi?id=3392465 Reported-by: Ozkan Sezer <sezeroz@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* compiler: Add fallthrough() helperCyrill Gorcunov2018-02-253-0/+40
| | | | | | https://bugzilla.nasm.us/show_bug.cgi?id=3392465 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: outobj -- Fix typo in obj_initCyrill Gorcunov2018-02-251-1/+1
| | | | | | | In 51b453b0970a1d66c3f6533ed940cb9838ba2b18 occasionally used wrong operand for sizeof. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* output: elf,ieee,macho,obj -- Fix mofule name for commit ↵Cyrill Gorcunov2018-02-254-0/+4
| | | | | | | | | | | | | | 81b62b9f54ac8e4019a9b2ec2b95ec0faa86bd2a These modules need a reference to input filename. For example elf put into symbol table | SYMBOL TABLE: | 0000000000000000 l df *ABS* 0000000000000000 sha-64.asm Otherwise this become empty string. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* get_cpu: Fix a7ecf2646d6c80b994be7d340140379d580050cfCyrill Gorcunov2018-02-251-0/+2
| | | | | | | | | | The call to iflag_clear_all has been occasionally dropped, bring it back. https://bugzilla.nasm.us/show_bug.cgi?id=3392466 Reported-by: sezeroz@gmail.com Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* compiler: Fix typo in 6686fc6Cyrill Gorcunov2018-02-241-1/+1
| | | | | | | https://bugzilla.nasm.us/show_bug.cgi?id=3392464 Reported-by: sezeroz@gmail.com Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
* openwcom.mak: use \ as path separatorsH. Peter Anvin2018-02-221-153/+153
| | | | | | | | | | Apparently OS/2 really wants \ as path separators, and that is really the main target for OpenWatcom these days, so change the path separator in this Makefile. For building on Linux we'd be better off with a GNU Makefile anyway, but what is the point, really... Reported-by: Andy Willis <abwillis1@gmail.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge branch 'master' of ssh://repo.or.cz/srv/git/nasmH. Peter Anvin2018-02-2216-284/+524
|\
| * Merge remote-tracking branch 'origin/nasm-2.13.xx'H. Peter Anvin2018-02-203-1/+81
| |\ | | | | | | | | | | | | | | | | | | Resolved Conflicts: version Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| | * version: bump to 2.13.04rc0 until we have an actual -rcnasm-2.13.xxH. Peter Anvin2018-02-141-1/+1
| | | | | | | | | | | | Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| | * insns.dat: add aliases of the RET instruction with explicit operand sizeH. Peter Anvin2018-02-143-1/+81
| | | | | | | | | | | | | | | | | | | | | Make it possible to generate variants of RET(F) with explicit operand size specified without having to use o16/o32/o64. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * | Fix problem with C99 inlines and -Werror=missing-prototypesH. Peter Anvin2018-02-204-10/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some older versions of gcc (gcc 4.2.1 at least) produce a warning, promoted to error, on C99 inlines. Do some work to figure out if we need to fall back to GNU inline syntax. Fix some issues with GNU inline syntax. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * | Merge branch 'nasm-2.13.xx'Cyrill Gorcunov2018-02-101-3/+1
| |\ \ | | |/ | | | | | | | | | | | | * nasm-2.13.xx: nasmlib: Drop pure_func attrib from seg_alloc nasmlib: Drop unused seg_init
| | * nasmlib: Drop pure_func attrib from seg_allocCyrill Gorcunov2018-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | It not only reads static variable but writes it back as well. https://bugzilla.nasm.us/show_bug.cgi?id=3392461 Reported-by: Michael Šimáček <msimacek@redhat.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| | * nasmlib: Drop unused seg_initCyrill Gorcunov2018-02-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | The helper has been eliminated in 2c4a4d5810d0a59b033a07876a2648ef5d4c2859 https://bugzilla.nasm.us/show_bug.cgi?id=3392461 Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>