aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* labels.c: use mempool allocator in labels.cmempoolH. Peter Anvin2018-06-031-194/+80
| | | | | | This replaces two custom allocators with mempool. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* mempool: define standard mempools, fixes to the mempool allocatorH. Peter Anvin2018-06-035-66/+131
| | | | | | | Define standard mempools reclaimed at various stages. Fix various problems with the mempool allocator. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* mempool: simple/fast "free all at once" memory allocatorH. Peter Anvin2018-06-035-0/+377
| | | | | | | | | | A simple memory allocator which allows an arbitrary set of memory allocations, followed by free-all-at-once for a particular pool, but still without returning memory to the operating system (for speed.) This should be faster than using malloc/free every time, even for good malloc implementations. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* gcc: fix mistakes discovered by recent gccH. Peter Anvin2018-06-022-2/+3
| | | | | | | Recent versions of gcc issue a couple of warnings, which may be real bugs. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* gcc: newer gcc trip on -Wstringop-truncation for valid uses of strncpy()H. Peter Anvin2018-06-021-0/+3
| | | | | | | | strncpy() is correctly used to fill in a zero-*padded* (not zero-terminated) field in several places. Make gcc not complain about those uses. Signed-off-by: H. Peter Anvin <hpa@zytor.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>
| * | asm: allow abort on panic to be specified at runtimeH. Peter Anvin2018-02-071-54/+54
| | | | | | | | | | | | | | | | | | New option --abort-on-panic to make debugging easier. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| * | Merge tag 'nasm-2.13.03'H. Peter Anvin2018-02-079-217/+341
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NASM 2.13.03 Resolved Conflicts: include/iflag.h version x86/insns-iflags.ph Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| | * NASM 2.13.03nasm-2.13.03H. Peter Anvin2018-02-071-1/+1
| | |
| | * doc: some more documentation on 64-bit programmingH. Peter Anvin2018-02-071-7/+14
| | | | | | | | | | | | | | | | | | Some more information about 64-bit programming and its quirks. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| | * doc: clarify need for ABS QWORD to do a 64-bit absolute loadH. Peter Anvin2018-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The rarely used 64-bit absolute load instruction (what gas calls movabsq) needs to be declared ABS if we are in relative mode, which is normally the case. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| | * doc: add a bit more text about 64-bit immediates and pointersH. Peter Anvin2018-02-071-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | There are some gotchas in how immediates and pointers are loaded in 64-bit mode and how they interact with optimization. Document those cases. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| | * NASM 2.13.03rc6nasm-2.13.03rc6H. Peter Anvin2018-02-071-1/+1
| | |
| | * doc/changes.src: add missing blank line between bullet pointsH. Peter Anvin2018-02-071-0/+1
| | | | | | | | | | | | | | | | | | | | | Bullet points are considered paragraphs, so our documentation compiler require an empty line between them. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| | * vaesenc.asm: add a few more test casesH. Peter Anvin2018-02-071-1/+17
| | | | | | | | | | | | Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
| | * NASM 2.13.03rc5nasm-2.13.03rc5H. Peter Anvin2018-02-061-1/+1
| | |