Commit Graph

2167 Commits

Author SHA1 Message Date
Cyrill Gorcunov
e091d6ed62 BR3041451: Implement upper bound for %rep counter
Since %rep counter is a 64 bit signed integer we have to use some
"maximum possible value" limit (upper bound) otherwise there may be
a situation when %rep counter is 0 or even negative while user
has been passing big positive integer value.

Reported-by: nasm64developer
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-09 18:35:35 +04:00
Keith Kanios
fe55e918fa preproc.c: added deprecation warning for context-local label fallthrough 2010-08-09 00:55:44 -05:00
Cyrill Gorcunov
73b34a5006 NASM 2.09rc6
It likely to be the last -rc before final relase.
Give it a good testing. We should be in pretty good
shape.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-06 19:25:17 +04:00
Cyrill Gorcunov
acf1cbb250 test: Add automatizing annotations to imm64.asm
H. Peter Anvin pointed
|
| Btw, test/imm64.asm needs test engine annotations.
|

Make it so.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-08-04 20:18:30 +04:00
H. Peter Anvin
b936aa61c8 insns.dat: unbreak test/imm64.bin
Unbreak the following subtest in test/imm64.bin:

	mov qword [rax],dword 11223344h

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-08-02 12:06:13 -07:00
Cyrill Gorcunov
d7b654c73d elf: Move stabs symbol table format into outelf.h
Get rid of code duplication

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-30 00:51:44 +04:00
Cyrill Gorcunov
16cbf9b5c2 nasmlib.c: fix typo in nasm_init_malloc_error
Typo happened in 9b603082 so -DLOGALLOC gets broken.
Not that important since this is a developer oriented
feature but should be fixed anyway.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-29 19:01:34 +04:00
Cyrill Gorcunov
fd90ef56ae NASM 2.09rc5 2010-07-28 22:03:43 +04:00
Cyrill Gorcunov
dea6c7a974 doc: Updates on macro ranges
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-28 18:00:24 +04:00
Cyrill Gorcunov
d143f4f39c labels.c: cleanup
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-28 18:00:18 +04:00
Cyrill Gorcunov
d3034cb13b Get rid of misc/altreg.inc
It's the same as macros/altreg.mac which is already included.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-28 18:00:06 +04:00
Cyrill Gorcunov
407e6c707f doc: Explain SECTALIGN
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-28 17:59:49 +04:00
Cyrill Gorcunov
455e087c6a doc: Fix ..sym section name misprint
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-27 01:48:27 +04:00
Cyrill Gorcunov
d6f31240c5 assemble.c: Style nitfix
Various tabs/space mixture cleaned and some more.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-26 23:16:45 +04:00
H. Peter Anvin
ab5bd05d82 Revert "Improve process_ea and introduce -OL"
This reverts commit ac732cb6a5.

Resolved Conflicts:

	doc/nasmdoc.src

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-25 12:43:30 -07:00
H. Peter Anvin
b453c866ab nasm.h: move "regs.h" to top; make is_register() a bool
Move the #include of regs.h to the top with the other includes, and
make is_register() -- being a boolean predicate -- return bool.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-25 00:17:12 -07:00
Cyrill Gorcunov
a38b86aecf move is_register helper to nasm.h
H. Peter Anvin noted:
 |
 | Could we avoid putting static code that has no dynamic content in
 | dynamically generated files... it just complicates things unnecessarily.
 |
 | The above can move into nasm.h for example.
 |

Good idea.

CC: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-25 11:09:56 +04:00
Cyrill Gorcunov
2124b7b7dc Use is_register helper
Save us some line of code

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-25 01:16:33 +04:00
Cyrill Gorcunov
79699d8eda regs.pl: Introduce is_register() helper
Instead of opencoded check use inline helper.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-25 01:10:17 +04:00
Victor van den Elzen
b8e699fb3d Remove redundant sentence in docs 2010-07-24 22:24:15 +02:00
Victor van den Elzen
ac732cb6a5 Improve process_ea and introduce -OL
Two fixes:
1. Optimization of [bx+0xFFFF] etc
   0xFFFF is an sbyte under 16-bit semantics,
   so make sure to check it right.

2. Don't optimize displacements in -O0
   Displacements that fit into an sbyte or
   can be removed should *not* be optimized in -O0.

   Implicit zero displacements are still optimized, e.g.:
   [eax] -> 0 bit displacement, [ebp] -> 8 bit displacement.
   However explicit displacements are not optimized:
   [eax+0] -> 32 bit displacement, [ebp+0] -> 32 bit displacement.

Because #2 breaks compatibility with 0.98,
I introduced a new optimization level: -OL, legacy.
2010-07-24 22:00:12 +02:00
Cyrill Gorcunov
088d151130 doc: Update changes.src
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-23 18:57:40 +04:00
Cyrill Gorcunov
4e1d5ab0cf preproc.: Fix NULL dereference on broken %strlen argument
Under particular circumstances %strlen may cause SIGSEG. A typical
example is %strlen with nonexistent macro argument.

[ Testcase test/strlen.asm ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-23 18:51:51 +04:00
H. Peter Anvin
077fb93d2b preproc: allow non-identifier character in environment variables
Allow non-identifier characters in the name of environment variables,
by surrounding them with string quotes (subject to ordinary
string-quoting rules.)

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-20 14:56:30 -07:00
Cyrill Gorcunov
aed4eaa8f3 changes.src: Fix misprint in "instructions" word.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-17 18:24:13 +04:00
H. Peter Anvin
6c74498114 nasmdoc: we still miss Chuck, but...
We still miss Chuck, but I don't think we can really say anymore we're
doing this particular release in his memory.

Requiescat in pace, our friend.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 22:51:26 -07:00
H. Peter Anvin
abe61900e4 Merge branch 'nasm-2.08.xx'
Resolved Conflicts:
	version

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 22:45:04 -07:00
H. Peter Anvin
5bc03271bd changes.src: update with the 2.08.xx changes
Patchlevels should be documented, too...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 22:44:03 -07:00
H. Peter Anvin
c23adff39b NASM 2.09rc4 2010-07-15 18:32:32 -07:00
H. Peter Anvin
31387b2d04 Make -Ox the default
Make -Ox the default; it's the optimization level expected by most
users, and it is clearly still causing confusion that it has to be
specified manually.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-15 18:30:18 -07:00
Bryant Keller
a537d4964e Documentation: describe %ifenv and friends
Signed-off-by: Bryant Keller <bkeller@assembly.ath.cx>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 23:49:39 +04:00
H. Peter Anvin
6d9b2b59b5 preproc: add %ifenv
Add %ifenv to test for the presence of an environment variable.  The
environment variable can, but does not have to be, prefixed with %!.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-13 12:00:58 -07:00
H. Peter Anvin
5b00bf4d49 BR3028880: Revert to nonfatal, better error message, cleanup
Revert to issuing a nonfatal error (it makes no sense to make it a
fatal error, but it probably makes sense for it to be an error instead
of a warning, especially since a lot of prior versions would crash and
apparently noone noticed.)  We might have to revisit this based on
user requirements, and/or provide a method for the user to detect an
existing environment variable (%ifenv?).

Issue a better error message, indicating the nature of the failure.

Simplify the code by just updating the string in "p".

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-13 11:46:37 -07:00
Cyrill Gorcunov
702df6d6cc Update changes.src
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:54 +04:00
Cyrill Gorcunov
41c5c6c36d BR3028880: Make nonexistent environment variable being fatal error
Frank suggested to just print out an error if environment
variable is not there. Agreed.

Suggested-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:49 +04:00
Cyrill Gorcunov
6405229b6d Check in test for BR3028880
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:31 +04:00
Cyrill Gorcunov
385d3e9c53 BR3028880: Fix NULL dereference on nonexistent environment variable
Frank reported we hit NULL dereference on nonexistent
environment variables. Fix it by leaving empty string
in text field of such token and yielding warning.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:24 +04:00
Cyrill Gorcunov
c6360a757b tokenize: Fix wrong string index in indirect strings
At moment of calling the nasm_skip_string the string pointer
is already incremented which makes tokenize fail on correct
indirect strings.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:16 +04:00
Cyrill Gorcunov
15bdc51187 preproc: Extract reading line from predefined macros from read_line
It makes read_line less complex

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:10 +04:00
Cyrill Gorcunov
924df0d498 Documentation updates
Various small fixes.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:17:03 +04:00
Cyrill Gorcunov
69ce75076c No need for \n at __OUTPUT_FORMAT__ macro end
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:16:57 +04:00
Cyrill Gorcunov
fed61a547f Merge branches 'master' and 'preproc-paste-fix' 2010-07-13 21:16:05 +04:00
Cyrill Gorcunov
984279b1dd BR3026808: Assign to local preprocessor variable does not work in 2.09
The commits

20a94ad7fe
29c96651de
13dbfad76b
6f5f7ef417
ddd08c3ccc

seems to do the tricks we need. Eventually
get rid of commented "case".

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-13 21:13:24 +04:00
H. Peter Anvin
dc2152ed0a nasmdoc: remove obsolete Sourceforge references
Remove obsolete Sourceforge references, replace with nasm.us.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2010-07-09 19:04:59 -07:00
H. Peter Anvin
7d43804633 NASM 2.09rc3 2010-07-09 19:02:28 -07:00
Cyrill Gorcunov
5483d495a7 NASM 2.08.02 2010-07-10 02:37:49 +04:00
Cyrill Gorcunov
7d96ac6a56 preproc.c: Fix NULL deref on token pasting
In case if there is a whitespace before
'paste' token we may reach NULL dereference
in strlen since paste_head will point to
TOK_WHITESPACE. Fix it.

[mainstream adabc1576b]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-10 02:34:05 +04:00
Cyrill Gorcunov
adabc1576b preproc.c: Fix NULL deref on token pasting
In case if there is a whitespace before
'paste' token we may reach NULL dereference
in strlen since paste_head will point to
TOK_WHITESPACE. Fix it.

[test: paste.asm]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
2010-07-10 02:14:24 +04:00
Cyrill Gorcunov
8ab945a259 preproc: add another test case
Add another test case for preprocessor token pasting.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-09 15:05:32 -07:00
H. Peter Anvin
20a94ad7fe preproc: don't paste TOK_PREPROC_ID
Trying to deal with bug reports 3005117 and 3026808: don't paste after
TOK_PREPROC_ID.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2010-07-08 11:52:57 -07:00