summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* test/ppindirect.asm: test token pasting inside %[...]indirectH. Peter Anvin2008-10-191-0/+3
| | | | | | Test for token pasting inside %[...]. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* preproc: fix terminal token pasting in indirect sequencesH. Peter Anvin2008-10-191-1/+29
| | | | | | | | Fix the case where the terminal token pastes with the first token of the unmodified sequence. This is a really ugly version; we need to merge the two instances plus the one in expand_mmac_params(). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* preproc: error on unterminated %[...]H. Peter Anvin2008-10-191-0/+2
| | | | | | Make unterminated %[...] constructs an error. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* preproc: fix exit conditions for indirection loopH. Peter Anvin2008-10-191-4/+3
| | | | | | | When locating the end of a %[...] construct, we need to end up with the pointer pointing to the terminating character. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* preproc: correctly handle quoted strings inside %[...] constructsH. Peter Anvin2008-10-191-7/+18
| | | | | | | We need to skip quoted strings when determining the ending point of %[...] constructs. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* doc: document the %[...] construct.H. Peter Anvin2008-10-191-0/+19
| | | | | | Add documentation for the %[...] construct. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* test: better smartalign testsH. Peter Anvin2008-10-194-34/+108
| | | | | | Smartalign tests for 16, 32 and 64-bit mode. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* smartalign: use a "times" construct rather than %repH. Peter Anvin2008-10-191-3/+2
| | | | | | | Use a "times" construct rather than "%rep" for higher performance. No need to preprocess the same line over and over for no good reason. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* macros.pl: handle \-continuation lines in macros.plH. Peter Anvin2008-10-191-0/+6
| | | | | | Correctly handle \-continuation lines in macros.pl. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* smartalign: rewrite to use the indirect construct, %[...]H. Peter Anvin2008-10-191-83/+21
| | | | | | | This code can be made so much smaller with clever use of the indirection construct. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* test: add test for preprocessor indirection constructH. Peter Anvin2008-10-191-0/+39
| | | | | | Add a test for the preprocessor indirection construct, %[...]. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* preproc: fix list iteration in the case of expand_indirect()H. Peter Anvin2008-10-191-34/+37
| | | | | | | | Linked lists where an element may be deleted or substituted during processing can be subtle to deal with. Fix the iteration conditions in this particular case. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* preproc: Add new %[...] indirection constructH. Peter Anvin2008-10-191-12/+83
| | | | | | Add a new %[...] construct to support indirect macro expansion. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* NASM 2.05rc7nasm-2.05rc7H. Peter Anvin2008-10-191-1/+1
|
* ELF64: once again, fix generation of "naked" OUT_REL*ADRH. Peter Anvin2008-10-181-10/+9
| | | | | | | | It is unclear if we will ever see any "naked" (absolute bytes) OUT_REL*ADR coming from the assembler, but if we do, we should generate them correctly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* NASM 2.05rc6nasm-2.05rc6H. Peter Anvin2008-10-171-1/+1
|
* doc/changes.src: document massive changes to ELF64 backendH. Peter Anvin2008-10-171-1/+1
| | | | | | | We didn't just fix the GOT stuff, but also now properly use RELA and so forth. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: PLT32, GOTPCREL, and GOTPCREL64 really need exactitudeH. Peter Anvin2008-10-171-3/+3
| | | | | | | | | | Now when the assembler is properly generating the address that we push down to the backend, enable requesting an exact value for these relocations (these are pointing to a specific GOT or PLT slot; the addend is used to adjust the computed value in the instruction, not for offset for the symbol.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: the "size" argument to OUT_REL*ADR isn't really the sizeH. Peter Anvin2008-10-171-3/+3
| | | | | | | | The "size" argument to the OUT_REL*ADR output types is actually intra-instruction offset, not the actual size. Thus, emit the size properly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* assemble: for OUT_REL*ADR, the "size" argument is not really size...H. Peter Anvin2008-10-171-5/+8
| | | | | | | | | For OUT_REL*ADR, the "size" argument is actually the offset inside the instruction; that is in fact why we encode the real size in the instruction itself. Thus, emit the offsets properly using this mechanism when generating relative EAs. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* test/elf64so.asm: demonstrate a case where we bind to the wrong symbolH. Peter Anvin2008-10-171-1/+6
| | | | | | | | Show an artificial case where we bind to the wrong symbol, due to the confusion in the output system between the size of relative symbols and their position. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: actually generate relative GOT/PLT references correctlyH. Peter Anvin2008-10-171-12/+10
| | | | | | | | | | | | Fix the arithmetic for relative GOT/PLT references. We still can't enable exactitude, because of the assumption that "size" is always the proper adjustment for the offset of the displacement inside the instruction, which is wrong in the case of displacements that are followed by an immediate. This also affects the list file, so it really should be fixed. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* test/Makefile: enable debugging info for elftest/elftest64H. Peter Anvin2008-10-171-6/+6
| | | | | | Enable debugging information for the ELF tests. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: GOTOFF64 doesn't need a gsym at allH. Peter Anvin2008-10-171-2/+1
| | | | | | | | GOTOFF64 is used for local variables (as a 64-bit offset from the GOT; only needed in the Medium PIC or Large PIC models.) It therefore should *not* be a elf_add_gsym_reloc() invocation. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: We apparently don't need exactitude for GOTOFF64H. Peter Anvin2008-10-171-1/+1
| | | | | | | | | | I am having a bit of a hard time understanding the proper operation of the "exact" flag to elf_add_gsym_reloc(). We apparently won't generate proper GOTOFF64 relocations with this flag set; it is possible that there are *no* proper uses of this flag. This clearly needs to be figured out. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* elftest64: both Small PIC and Medium PIC model testsH. Peter Anvin2008-10-172-10/+35
| | | | | | Try both Small PIC and Medium PIC model references. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: GOT and PLT references need a symbol (a slot!) to referenceH. Peter Anvin2008-10-171-26/+33
| | | | | | | | | GOT and PLT references need a symbol; after all, they reference a GOT or PLT slot. Thus, they need elf_add_gsym_reloc(). Mungify the interface so that they can communicate the need for the PC-shifted offset into the relocation. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: unbreak generating no-segment addressesH. Peter Anvin2008-10-171-111/+138
| | | | | | | | When generating an address that is *not* tied to a symbol, we just want to emit the bytes. I believe the assembler is already supposed to do that for us, but just in case, do it right here too. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* SAA: add saa_writeaddr() similar to other locationsH. Peter Anvin2008-10-172-0/+22
| | | | | | Provide saa_writeaddr() to write an integer in x86 format. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* test/Makefile: the elftest objects depend on $(NASM)H. Peter Anvin2008-10-171-2/+2
| | | | | | If NASM has changed, we logically want to re-run the ELF tests... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: use the RELA addend field instead of relying on the code streamH. Peter Anvin2008-10-171-80/+94
| | | | | | | | | | The x86-64 ABI wants the symbol addend to reside in the addend field of the RELA relocation, not in the code stream. Apparently it's something one can get away with, but the linker would still botch it for some cases. Change it so we pass the proper output and emit zero into the code stream. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Test and Makefile rules for 32- and 64-bit ELF shared librariesH. Peter Anvin2008-10-174-0/+160
| | | | | Add Makefile rules for the 32-bit ELF shared library test, and add a 64-bit ELF shared library test (still work in progress.)
* NASM 2.05rc5nasm-2.05rc5H. Peter Anvin2008-10-161-1/+1
|
* Test for BR 2172659H. Peter Anvin2008-10-161-0/+15
| | | | | | Test for the bug fix for BR 2172659 (invalid byte-sized immediates.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* BR 2172659: Fix incorrect output value for byte operandsH. Peter Anvin2008-10-161-2/+2
| | | | | | | A typo in checkin c1377e9a98dd5ca6f7900c048df5d346d1733d05 caused a bunch of signed-byte immediates to incorrectly be issued as zero. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Add reference to %+ from macro parameter concatenationH. Peter Anvin2008-10-151-0/+2
| | | | | | | Add a reference to the %+ operator from the section on macro parameter concatenation. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* doc: minor editorial changeH. Peter Anvin2008-10-151-4/+4
| | | | | | | Use the terms "defined" and "expanded" for single-line macros more consistently. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* ELF64: fix various GOT relocationsH. Peter Anvin2008-10-151-9/+35
| | | | | | | Try to make the various GOT relocations do the right thing in ELF64, including erring out when appropriate. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Test for various ELF64 GOT referencesH. Peter Anvin2008-10-151-0/+25
| | | | | | Try to test for various GOT references in ELF64. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* doc: add link to the macro packages when talking about themH. Peter Anvin2008-10-151-2/+2
| | | | | | | When discussing the standard macro packages in the context of __USE_*__ macros, link to them as well as to the %use directive. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* BR 2164053: --prefix _ not --prefix_H. Peter Anvin2008-10-131-1/+1
| | | | | | | The --prefix option takes a separate argument, not an attached argument. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* NASM 2.05rc4nasm-2.05rc4H. Peter Anvin2008-10-121-1/+1
|
* Document RIP-relative GOT fixes in ELF64H. Peter Anvin2008-10-121-0/+2
|
* Fix typo in previous outelf64.c commitCharles Crayne2008-10-121-1/+0
| | | | Stray line fragment left in when removing debug code.
* RIP rel relocations for PIC released for testing.Charles Crayne2008-10-121-12/+45
| | | | | | | | | | | | Expressions like mov r15,[rel integer wrt ..got] lea rax,[rel integer wrt ..gotoff] now assemble correctly. In addition, a fix has been made to the corresponding abs relocations. Both of these areas still need additional testing.
* assemble.c: use case4() macros like in disasm.cH. Peter Anvin2008-10-091-227/+147
| | | | | | | | | Use the case4() macros as we already do in disasm.c. It helps reduce visual clutter, and more clearly demonstrates that groups of four belong together. Furthermore, it makes the text compact enough that we can now use case statements to mask down the EA patterns correctly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* disasm: collapse all the segment register push/pop bytecodesH. Peter Anvin2008-10-091-59/+2
| | | | | | | | As far as the disassembler is concerned, the segment register push/pop bytecodes can be collapsed to a simple expression; the remaining differences are handled by the filter expressions in insns.pl. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* test/pushseg.asm: add "pop cs"H. Peter Anvin2008-10-081-1/+1
| | | | | | | "pop cs" is an 8086-only opcode; we support it for assembly but not for disassembly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* test/pushseg.asm: test for push/pop of segment registersH. Peter Anvin2008-10-081-0/+17
| | | | | | Simple test for push/pop of segment registers. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Reshuffle and move the bytecodes for segment register push/popH. Peter Anvin2008-10-084-124/+126
| | | | | | | | | Reshuffle the bytecodes for segment register push/pop to make more sense, and move them from \4 to \344, thus freeing up the single-digit bytecodes \4..\7 for future use. It doesn't really make sense to use single-digit bytecodes for this very oddball use. Signed-off-by: H. Peter Anvin <hpa@zytor.com>