Commit Graph

1525 Commits

Author SHA1 Message Date
H. Peter Anvin
bcc3bb975c test/crc32.asm: test the CRC32 instruction
Test for the CRC32 instruction.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-23 16:24:02 -07:00
H. Peter Anvin
019a98dab1 BR 2190521: fix the CRC32 opcodes
A stray \1 bytecode was hiding in the CRC32 opcodes, causing complete
havoc.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-23 16:23:19 -07:00
H. Peter Anvin
6c13a09e75 NASM 2.05rc8 2008-10-22 11:23:18 -07:00
H. Peter Anvin
49b3a3c2af BR 2187210: Fix PFRCPV and PFRSQRTV
Fix the Geode instructions PFRCPV and PFRSQRTV per bug report 2187210.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-22 11:18:27 -07:00
H. Peter Anvin
e286c7e79c assemble: not all backends handle intra-segment OUT_REL*ADR
Not all backends can handle being handled an intrasegment OUT_REL*ADR,
and we don't fix them up in common code either (which would be the
logical thing to do -- right now we fix them up in a bunch of
individual places.)

For now, just fix up the one in address generation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-22 11:15:00 -07:00
H. Peter Anvin
9cd543e5fd BR 2148448: fix relative addresses in bin output
The "bin" format was misinterpreting the overloading of the "size"
argument to out(), which caused another source of 64-bit relative
offset errors.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-22 11:05:43 -07:00
H. Peter Anvin
d3fcbf051d Update .gitignore to include additional generated files
pptok.ph and doc/inslist.src are generated files; list them in
.gitignore.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 22:25:11 -07:00
H. Peter Anvin
207b1c4d3d test/ppindirect.asm: test token pasting inside %[...]
Test for token pasting inside %[...].

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 22:23:12 -07:00
H. Peter Anvin
49b33f398e preproc: fix terminal token pasting in indirect sequences
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>
2008-10-19 22:22:05 -07:00
H. Peter Anvin
e126581f4d preproc: error on unterminated %[...]
Make unterminated %[...] constructs an error.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 22:14:30 -07:00
H. Peter Anvin
ec03301eb4 preproc: fix exit conditions for indirection loop
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>
2008-10-19 22:13:34 -07:00
H. Peter Anvin
ca544db4b6 preproc: correctly handle quoted strings inside %[...] constructs
We need to skip quoted strings when determining the ending point of
%[...] constructs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 19:30:11 -07:00
H. Peter Anvin
0ca00860df doc: document the %[...] construct.
Add documentation for the %[...] construct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 17:00:52 -07:00
H. Peter Anvin
2d4722fe4c test: better smartalign tests
Smartalign tests for 16, 32 and 64-bit mode.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 16:47:53 -07:00
H. Peter Anvin
f991f5ae56 smartalign: use a "times" construct rather than %rep
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>
2008-10-19 16:45:27 -07:00
H. Peter Anvin
9f9fcfa455 macros.pl: handle \-continuation lines in macros.pl
Correctly handle \-continuation lines in macros.pl.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 16:44:02 -07:00
H. Peter Anvin
777cdbee01 smartalign: rewrite to use the indirect construct, %[...]
This code can be made so much smaller with clever use of the
indirection construct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 16:38:28 -07:00
H. Peter Anvin
45d5f2f822 test: add test for preprocessor indirection construct
Add a test for the preprocessor indirection construct, %[...].

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 16:25:57 -07:00
H. Peter Anvin
c0ab1cd15a preproc: fix list iteration in the case of expand_indirect()
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>
2008-10-19 16:24:53 -07:00
H. Peter Anvin
992fe7591d preproc: Add new %[...] indirection construct
Add a new %[...] construct to support indirect macro expansion.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-19 15:45:05 -07:00
H. Peter Anvin
8b5e68079a NASM 2.05rc7 2008-10-19 14:53:48 -07:00
H. Peter Anvin
21da3006b5 ELF64: once again, fix generation of "naked" OUT_REL*ADR
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>
2008-10-18 11:29:11 -07:00
H. Peter Anvin
a368644138 NASM 2.05rc6 2008-10-17 23:37:43 -07:00
H. Peter Anvin
3ffd0fc157 doc/changes.src: document massive changes to ELF64 backend
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>
2008-10-17 23:36:45 -07:00
H. Peter Anvin
2a282275fe ELF64: PLT32, GOTPCREL, and GOTPCREL64 really need exactitude
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>
2008-10-17 23:32:40 -07:00
H. Peter Anvin
7f1315070e ELF64: the "size" argument to OUT_REL*ADR isn't really the size
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>
2008-10-17 23:30:54 -07:00
H. Peter Anvin
0a20bcfaf1 assemble: for OUT_REL*ADR, the "size" argument is not really size...
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>
2008-10-17 23:29:11 -07:00
H. Peter Anvin
93c7aa2302 test/elf64so.asm: demonstrate a case where we bind to the wrong symbol
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>
2008-10-17 23:14:53 -07:00
H. Peter Anvin
d5e7498556 ELF64: actually generate relative GOT/PLT references correctly
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>
2008-10-17 23:06:46 -07:00
H. Peter Anvin
9d8b57d081 test/Makefile: enable debugging info for elftest/elftest64
Enable debugging information for the ELF tests.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-17 23:03:54 -07:00
H. Peter Anvin
8218572d5e ELF64: GOTOFF64 doesn't need a gsym at all
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>
2008-10-17 22:22:17 -07:00
H. Peter Anvin
bdfd3b3b87 ELF64: We apparently don't need exactitude for GOTOFF64
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>
2008-10-17 22:11:20 -07:00
H. Peter Anvin
15ed768673 elftest64: both Small PIC and Medium PIC model tests
Try both Small PIC and Medium PIC model references.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-17 22:10:33 -07:00
H. Peter Anvin
70e6c2a6cb ELF64: GOT and PLT references need a symbol (a slot!) to reference
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>
2008-10-17 20:01:16 -07:00
H. Peter Anvin
8140afbaf1 ELF64: unbreak generating no-segment addresses
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>
2008-10-17 19:32:10 -07:00
H. Peter Anvin
edb58f7813 SAA: add saa_writeaddr() similar to other locations
Provide saa_writeaddr() to write an integer in x86 format.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-17 19:30:34 -07:00
H. Peter Anvin
9a1f9f5ab6 test/Makefile: the elftest objects depend on $(NASM)
If NASM has changed, we logically want to re-run the ELF tests...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-17 19:29:15 -07:00
H. Peter Anvin
64fa04f019 ELF64: use the RELA addend field instead of relying on the code stream
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>
2008-10-17 18:23:29 -07:00
H. Peter Anvin
e41b69beaf Test and Makefile rules for 32- and 64-bit ELF shared libraries
Add Makefile rules for the 32-bit ELF shared library test, and add a
64-bit ELF shared library test (still work in progress.)
2008-10-17 17:13:26 -07:00
H. Peter Anvin
d83fb7e338 NASM 2.05rc5 2008-10-16 13:05:09 -07:00
H. Peter Anvin
d41e07bd2e Test for BR 2172659
Test for the bug fix for BR 2172659 (invalid byte-sized immediates.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-16 13:03:40 -07:00
H. Peter Anvin
779ed8bcfd BR 2172659: Fix incorrect output value for byte operands
A typo in checkin c1377e9a98 caused a
bunch of signed-byte immediates to incorrectly be issued as zero.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-16 13:01:43 -07:00
H. Peter Anvin
44d3552ab9 Add reference to %+ from macro parameter concatenation
Add a reference to the %+ operator from the section on macro parameter
concatenation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-15 16:18:17 -07:00
H. Peter Anvin
850ba56f1d doc: minor editorial change
Use the terms "defined" and "expanded" for single-line macros more
consistently.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-15 16:14:39 -07:00
H. Peter Anvin
c3cea48430 ELF64: fix various GOT relocations
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>
2008-10-15 15:23:18 -07:00
H. Peter Anvin
b048324b9e Test for various ELF64 GOT references
Try to test for various GOT references in ELF64.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-15 15:22:03 -07:00
H. Peter Anvin
a3e57106fa doc: add link to the macro packages when talking about them
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>
2008-10-15 11:15:48 -07:00
H. Peter Anvin
d5118f2009 BR 2164053: --prefix _ not --prefix_
The --prefix option takes a separate argument, not an attached
argument.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-10-13 10:17:27 -07:00
H. Peter Anvin
d3671e061d NASM 2.05rc4 2008-10-12 21:17:34 -07:00
H. Peter Anvin
8cd1df87e5 Document RIP-relative GOT fixes in ELF64 2008-10-12 21:17:04 -07:00