Commit graph

1948 commits

Author SHA1 Message Date
H. Peter Anvin
801a218854 AUTHORS: convert to UTF-8
Convert Latin-1 character to UTF-8.  This is 2009.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-30 12:07:31 -08:00
H. Peter Anvin
b512fb56db outmacho32: replace error() -> nasm_error()
Somehow outmacho32.c escaped the global change of error variables to
hard-coded nasm_error().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-30 11:27:47 -08:00
H. Peter Anvin
f92befabba NASM 2.08rc5 2009-11-28 15:35:51 -08:00
H. Peter Anvin
1199cddebb test/Makefile: make it easier to inject options
Make it easier to inject options into test compiles.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-28 15:34:32 -08:00
Cyrill Gorcunov
bd38c8f231 preproc.c: expand_smacro -- break endless loop for interminable macro recursion
Frank reported:
|
| From the "expert questions" forum comes this:
|
| ---------------------
| By: jasper_neumann
|
| How can I delegate %undef?
|
| In the example below the assembler (called with "nasm.exe -t -f rdf q.asm")
| bemoans my code, displays
|
| "q.asm:19: error: interminable macro recursion"
|
| and hangs.
|
| q.asm
| -----
| bits 32
| CPU P4
|
| %macro my_def 2
|  %xdefine %1 esp+%2
| %endmacro
|
| %macro my_undef 1
|  %undef %1
| %endmacro
|
| global check_it
| check_it:
|  my_def x,4
|  mov eax,[x]
|  my_undef x
|
|  my_def x,8
|  add eax,[x]
|  my_undef x
|  ret
|

So in case of interminable macro recursion we should break
the expansion procedure that way to not return back and start
expand macro again.

This address a part of the original problem.
Nasm64developer pointed out:
|
| Btw, after you manage to fix this recursion problem, the code
| in question still faces the same fundamental issue -- the arg
| to the my_undef invocations (i.e. x) gets expanded first; thus
| the %undef inside the macro sees esp+4 and esp+8 instead
| of x, and fails. What you'd need is a means to prevent the ex-
| pansion -- look for e.g. %# in 4.1.4 of the manual.txt which is
| attached to SF #1842438; it implements exactly that -- I once
| filed SF #829879 for this feature.
|

In turn Keith Kanios said:
|
| Anon is also correct in that we would need a special directive to instruct
| the delay of macro expansion, although I don't see this as critical or even
| high priority at the moment. The intermediate solution for this is, don't
| use indirection if it is not needed... an inline %undef should be
| sufficient.
|

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: Keith Kanios <keith@kanios.net>
2009-11-21 11:11:29 +03:00
Cyrill Gorcunov
bc0113d977 outcoff: BuildExportTable -- tab/space fix
Due to previous commit an indent by tab (occasionally) brought in.
Fix it as well. No change on binary level.

We're not that far from NASM release so it's a bit unpleasant
manner to push in such trivial change. But since it's the previous
commit dependent -- I dare to push it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-17 23:25:15 +03:00
Cyrill Gorcunov
bf8cebd813 outcoff: Do not fail on long export identifiers
If an export identifier is greater then 241 symbols
we do fail due to buffer overflow. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-17 20:49:58 +03:00
H. Peter Anvin
6293bd45eb NASM 2.08rc4 2009-11-13 14:12:37 -08:00
Victor van den Elzen
02c9a72fdd Update test files
Remove references to DREX instructions
2009-11-11 08:09:03 +01:00
Victor van den Elzen
30621f4d0c Add test/bisect.sh for use with "git bisect" 2009-11-11 07:47:39 +01:00
Victor van den Elzen
b9856a266e Don't boundcheck 64-bit numbers, it gives problems due to overflows 2009-11-11 07:39:21 +01:00
H. Peter Anvin
cfe46ecfec NASM 2.08rc3 2009-11-09 16:54:48 -08:00
H. Peter Anvin
96690c6ee4 insns.dat: remove non-DREX SSE5 instructions
Even the non-DREX SSE5 instructions appear to have been either
obsoleted or replaced with XOP varieties.  The only exception are the
ROUNDxx instructions, which are really SSE4.1 instructions and which
were simply duplicates.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-09 16:53:43 -08:00
H. Peter Anvin
5792483c7d changes.src: document removal of DREX instructions
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-09 14:58:45 -08:00
H. Peter Anvin
2dad3ccd17 SSE5: remove all DREX-based instructions
AMD has obsoleted the DREX-based SSE5 proposal, so remove all such
instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-09 14:57:19 -08:00
Cyrill Gorcunov
2e7a84b829 outelf32/64 - various cleanups in a sake of unification
Make a small step forward elf32/64 unification procedure.
Mostly style fixes. Nothing serious.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:59 +03:00
Cyrill Gorcunov
b15ed1f836 dwarfX_output: dont check for "ln" twice
And make dwarf64 version to be more familiar to
32bit version (preparation work for merge).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:54 +03:00
Cyrill Gorcunov
24f9398a6f output/outelf64.c: simplify stabs64_cleanup, dwarf64_cleanup
nasm_free is failsafe against NULL passed

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:49 +03:00
Cyrill Gorcunov
b9771908b6 Document BR 2887108 in changes.src
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:45 +03:00
Cyrill Gorcunov
a50f829435 Merge elf header files
Merge elfcommon.h, elf32.h, elf64.h into
single elf.h -- we do support both elf32
and elf64 anyway. Let put them into common
place.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:41 +03:00
Cyrill Gorcunov
4139c9af86 hash_init: check for size being power of two
It's really a bug if size is not power of
two. We must to be sure all callers are
sane.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 22:00:37 +03:00
Cyrill Gorcunov
2967fee0bb hashtbl.c: Unify common hash ops by macros
Instead of opencoded repeatable computation
use macro helpers.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 21:58:48 +03:00
Cyrill Gorcunov
09e2895fbe Introduce is_power2 helper
We will need it for hash tables

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 21:01:45 +03:00
H. Peter Anvin
19f9f60efb MOVD xmmreg: not valid with REX.W
The xmmreg forms of MOVD are invalid with REX.W, since those are MOVQ
instructions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-06 09:36:11 -08:00
Cyrill Gorcunov
1de9500c89 Comment out matches() operand flags logic
Also space fix

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-06 00:08:38 +03:00
Cyrill Gorcunov
acf256f4db nasmlib.h: Introduce nasm_build_assert
It's useful to protect our self from some
errors at build time.

For this sake we should use nasm_build_assert
if needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-05 23:35:04 +03:00
H. Peter Anvin
638c1ac078 test: imul.asm: move warning-generated tests under WARN
Only make the tests under WARN actually issue warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-03 16:35:19 -08:00
H. Peter Anvin
623fedfa59 test: imul.asm: more IMUL pattern tests
Test more IMUL patterns.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-03 15:59:47 -08:00
H. Peter Anvin
fc89fe80d7 NASM 2.08rc2 2009-11-03 15:59:24 -08:00
Cyrill Gorcunov
bc31bee760 matches: simplify check operand size actions
We may throw out j variable (since we break anyway)
and don't assign asize for free (since we don't
use it after).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-03 21:37:09 +03:00
Cyrill Gorcunov
b640a917cd IMUL: sbyteX fix -- last one
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-11-03 21:35:24 +03:00
H. Peter Anvin
b0a6230a80 IMUL: fix an additional incorrect sbyte use
One more incorrect use of sbyte in IMUL.

Overall, the IMUL patterns seem really messy.  *Furthermore*, despite
IMUL normally being thought of as signed, the 2- and 3-operand
versions don't produce a high half and are therefore
signedness-agnostic -- we could even add MUL patterns for those forms.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-03 09:34:09 -08:00
H. Peter Anvin
110e5ecec4 BR 2887108: fix incorrect sbyte usage in IMUL
Fix a very curious transposition in the instruction patterns for IMUL,
which caused 32-bit IMUL instructions with constants like 0x10001 to
be generated incorrectly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-11-03 09:26:58 -08:00
Cyrill Gorcunov
210c10110b Revert "BR 2887108: Use overflow_ helper to catch inappropriate imm optimization"
This reverts commit 41208028ff.
|
| From: "H. Peter Anvin" <hpa@zytor.com>
|
| The tests for overflow_signed() are wrong too.  Those are relevant for if a
| warning should be issued, but not for how the value should be encoded in
| the byte stream.
|

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2009-11-01 10:24:48 +03:00
Cyrill Gorcunov
beaef4a2ea stdscan.c: use TOKEN_EOS and string helpers
Also tab/space cleanup

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:05:50 +03:00
Cyrill Gorcunov
cfbcddf1a5 Various tab/space/comment cleanup
No change on binary level

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:05:32 +03:00
Cyrill Gorcunov
a353955a8d output/outelf32-64: use string helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:03:29 +03:00
Cyrill Gorcunov
54e94a56e2 Remove outdated comments
From Frank Kotler:
| ...
| > -                stdscan_bufptr = saveme;        /* bugfix? fbk 8/10/00 */
| > +                stdscan_set(saveme);            /* bugfix? fbk 8/10/00 */
|
| While you're at it, you could remove my comment(s - it seems to have
| reproduced). It *is* a bugfix (apparently). "saveme" might have a better
| name, too...

So get rid of the comments.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:03:14 +03:00
Cyrill Gorcunov
917117ff69 stdscan: switch to stdscan_get/set routines
Instead of manipulating stdscan buffer pointer directly
we switch to a routine interface.

This allow us to unify stdscan access: ie caller should
"talk" to stdscan via stdscan_get/set routines.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:02:43 +03:00
Cyrill Gorcunov
bafd877d48 nasmlib: Introduce idata_bytes helper
This allow us to eliminate code duplication

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 20:02:14 +03:00
Cyrill Gorcunov
41208028ff BR 2887108: Use overflow_ helper to catch inappropriate imm optimization
We should use overflow_ helpers before check if an immediate
operand fit a type range, otherwise we may loose high bits.

For example when we assemble the following instruction

	imul eax,eax,0x10000

with -Ox passed we optimze it up to imm8 though it must be imm32.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-31 10:35:11 +03:00
Keith Kanios
4ea846623a changes.src: document preprocessor directives added since 2.07
nasmdoc.src: document %exitmacro
2009-10-25 14:06:24 -05:00
Keith Kanios
3c0d91f3d5 preproc.c: fix exitmacro to account for if/endif blocks 2009-10-25 13:28:03 -05:00
Cyrill Gorcunov
e4f526be5c continue using is_class helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-18 12:41:14 +04:00
Cyrill Gorcunov
66ba8cdba1 changes.src: describe changes since version 2.07 up to 2.08rc1
There are already new commits which fix other bugs
but at moment only changes up to 2.08rc1.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-18 01:09:40 +04:00
Keith Kanios
d2a553c072 BR 2840300: fix macho symbol alignment bug 2009-10-16 21:53:59 -05:00
Cyrill Gorcunov
c2509508b5 parser.c: pasrse_line -- fix alignment
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2009-10-14 19:39:22 +04:00
H. Peter Anvin
a7643f4c04 assemble: xsizeflags[] is an opflags_t variable
One more case of int32_t instead of opflags_t...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-13 12:32:20 -07:00
H. Peter Anvin
f8563f7a98 opflags: more int32_t -> opflags_t conversions
Hopefully this should catch all of them... but please keep an eye out
for any other uses of int32_t for the operand flags.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-10-13 12:29:01 -07:00
H. Peter Anvin
970b1012ee NASM 2.08rc1 2009-10-13 12:05:01 -07:00