Commit Graph

1535 Commits

Author SHA1 Message Date
H. Peter Anvin
2aa72b64a6 rdsrc.pl: handle tabs in the input
It is just to painful to keep the source files tab-free.  Handle tabs
in the input as required.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-30 17:12:19 -07:00
H. Peter Anvin
e232d9a6bf doc: remove tab
The documentation processor doesn't like tabs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-30 17:07:14 -07:00
H. Peter Anvin
972079f6a8 Put the static information about warnings in a structure
Put the static information about warnings in a structure, so one can
see what goes with what.  Also, change the sense so "true" means
enabled.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-30 17:01:23 -07:00
H. Peter Anvin
2f16043879 Allow %warning output to be suppressed
Allow the user to suppress user-specified warnings.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-30 16:39:17 -07:00
H. Peter Anvin
2d5baaa69a assemble.c: cleanups
Formatting and some other minor cleanups.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-30 16:31:06 -07:00
H. Peter Anvin
dc0bf47feb Document the -O0 and -O1 behaviors.
Document the way the -O0 and -O1 options actually behave.  -O0, in
particular, is NASM 0.98 compatibility mode.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-30 16:24:47 -07:00
Charles Crayne
f1aefd8456 Change behavior of -O0 and -O1 for backward compatibility
-O0: JMP default to NEAR, Jcc/LOOP/JCXZ default to SHORT.
      In other words, this is reverting to full-blown 0.98 behavior, not
      0.98.39.
-O1: JMP and Jcc default to NEAR, LOOP/JCXZ default to SHORT (only
      possible form).
2008-09-30 16:11:32 -07:00
Charles Crayne
3cc2459944 Document a64 and o64 qualifiers
Add references and index entries for a64 and o64.
2008-09-26 17:13:09 -07:00
H. Peter Anvin
0819e3b9a7 Add more 64-bit jump tests 2008-09-25 23:45:20 -07:00
H. Peter Anvin
6f87180c3f JMP reg64 does not require a REX.W prefix.
We were redundantly emitting a REX.W prefix for JMP reg64.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-25 23:42:28 -07:00
H. Peter Anvin
bbf8be4b57 NASM 2.04 2008-09-25 17:07:41 -07:00
H. Peter Anvin
61f130f4e9 Set __PASS__ to 3 for preprocess only
When running the preprocessor only, set __PASS__ to 3.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-25 15:45:06 -07:00
H. Peter Anvin
2c8ad285fd Clean up unterminated lines 2008-09-25 02:33:24 -07:00
H. Peter Anvin
152656f8d3 Actually make non-power-of-2 alignments work
We can't use ($$-$) % (%1) since the wraparound will be wrong except
for powers of 2.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-25 02:31:50 -07:00
H. Peter Anvin
6e79efc26b NASM 2.04rc6 2008-09-24 17:39:03 -07:00
H. Peter Anvin
010aee270f Document __PASS__
Document __PASS__, but discourage users from using it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-24 17:34:37 -07:00
H. Peter Anvin
7383b407d9 Add __PASS__ builtin macro
Add a new builtin macro, __PASS__, which is either 1 (for a
preparatory pass), 2 (for a final pass, including preprocessor only),
or 0 (for dependency generation.)  This might be useful in special
contexts.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-24 10:20:40 -07:00
H. Peter Anvin
917a3496f0 Unbreak %warning
Since the error directives, including %warning, are now issued in the
final pass only, it is important that we do *not* pass ERR_PASS1 with
%warning.  Rather than playing even more ugly games in error(),
require ERR_PASS1 to be passed in with warnings elsewhere in the
preprocessor, just like the rest of the system.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-24 09:14:49 -07:00
H. Peter Anvin
13f1f3eed6 doc/changes.src: something closer to final release notes for 2.04
doc/changes.src should contain the user-visible changes in human
comprehensible form (release notes, not a changelog.)  Get something
closer to what it should look like for 2.04.
2008-09-24 08:59:29 -07:00
H. Peter Anvin
314b5f9a12 nasmdoc.src: more consistent indentation in %error section
We had different indentation levels only two paragraphs apart.
Overall, the document is horribly inconsistent about indentation,
which should be fixed.
2008-09-24 08:46:50 -07:00
H. Peter Anvin
9ebf2cb938 test/fwdoptpp: test %error, %warning, %fatal
Test all of %error, %warning, and %fatal.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-24 00:30:46 -07:00
H. Peter Anvin
e2ee25a7e1 NASM 2.04rc5 2008-09-24 00:26:09 -07:00
H. Peter Anvin
8e3f75ea6e %error, %warning out on the final pass, add %fatal
Only process %error or %warning directives on the final pass.  Add a
new %fatal directive which terminates assembly immediately.
2008-09-24 00:21:58 -07:00
Charles Crayne
7f596e7aa8 Allow value to TIMES to be negative while optimization is in progress
Change the parser to only issue the "TIMES value %d is negative"
error message if all optimization passes have completed.
2008-09-23 21:49:09 -07:00
H. Peter Anvin
0af3e7ed3c test: test for code that relies on the optimizer to be valid
There exists a fair bit of code out there which relies on the
optimizer in order to fit inside a predefined envelope.  NASM 2.04rc4
breaks this; write a simple test to demonstrate.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-23 17:09:52 -07:00
H. Peter Anvin
0b505c866f NASM 2.04rc4 2008-09-22 17:16:30 -07:00
Victor van den Elzen
3b404c0f6b BR 1239818 - handle multiple %else clauses
Using multiple %else clauses or mixing %else and %elif
caused strange results.
Warn about it and produce sensible results.
2008-09-18 13:51:36 +02:00
H. Peter Anvin
9ef3017240 NASM 2.04rc3 2008-09-12 18:12:03 -07:00
Charles Crayne
c1905c2169 Halt assembly if addresses are not converging.
Change global_offset_changed from bool to int so that
progress of convergence can be monitored. If change count
does not decrease from previous pass, increment stall counter.
If stall count reaches threshold, terminate assembly
with error message.
2008-09-11 18:54:06 -07:00
Victor van den Elzen
4252823e95 Limit number of passes to 1000
Now NASM won't take unreasonable an amount of time to generate
wrong code when it encounters equ's that don't converge, ex:

FOO equ FOO + 1
2008-09-11 15:07:05 +02:00
Victor van den Elzen
28f4634634 Remove obsolete ROL-EQU hack
Now that there is proper forward reference resolution,
we can get rid of this junk. Wiping the flags also
removed the SBYTEnn flags, causing

cmp eax, a-b
a: nop
b:

to assemble with -Ox like

cmp eax, strict dword -1

This is now fixed.
2008-09-11 13:14:23 +02:00
H. Peter Anvin
233c4945b1 doc: document the use of macros in %error
Document the use of macros in %error and %warning, valid since 2.03.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-10 23:34:39 -07:00
H. Peter Anvin
1dc23a1b39 doc: Call %xdefine a "resolving define" instead of "enhancing define"
%xdefine is an early-binding %define (%define being late-binding.)
There is nothing "enhanced" about it, it just specifies a different
policy.  Call it a "resolving define" instead.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-10 23:29:45 -07:00
H. Peter Anvin
3f85cfc766 doc: clean up formatting around -O option
Clean up the formatting in descriptions of the -O option.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-10 23:27:10 -07:00
H. Peter Anvin
ae13e10593 NASM 2.04rc2 2008-09-10 23:05:18 -07:00
H. Peter Anvin
a2d542ccaa changes: document optimizer change 2008-09-10 23:04:56 -07:00
Charles Crayne
2581c869b1 Decouple forward references from optimization
Users who wish to control the level of optimization can
continue to specify -O0, -O1, or -Ox,
where x can be the letter itself, or any number > 1.

However, even with optimization turned off,
NASM will always make enough passes to resolve
forward references. As a result, INCBIN is now the only
item left in the critical expressions list, although TIMES
still has its own constant value check.
2008-09-10 19:21:52 -07:00
H. Peter Anvin
325a4bff50 Run "make alldeps" 2008-09-09 09:54:47 -07:00
H. Peter Anvin
49039ab636 macros.pl: don't include macros for disabled output formats
Don't include macros for output formats we aren't compiling in.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-09 09:54:03 -07:00
H. Peter Anvin
5618e0063d outaout.mac: aoutb is an alias for aout
aoutb is an alias format for aout (in the sense they use the same
macro set.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-09 09:53:20 -07:00
H. Peter Anvin
d4ca24338b macros.pl: be a bit more careful with open()
Be a bit more strict with open() calls.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-09 09:43:16 -07:00
H. Peter Anvin
c357381da4 macros: win32 and win64 are COFF, not Mach-O
Somehow the win32 and win64 aliases got listed on Mach-O, not on
COFF.  This doesn't have any effect on the current code, but might in
the future.  Correct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-09 09:37:37 -07:00
H. Peter Anvin
fe1e649b7c NASM 2.04rc1 2008-09-03 15:25:33 -07:00
H. Peter Anvin
3f5ec289e7 Remove obsolete tagrelease script (duplicate of tag-release) 2008-09-03 15:22:23 -07:00
H. Peter Anvin
df73e0b63a Update doc/changes.src 2008-09-03 15:16:44 -07:00
H. Peter Anvin
39e9a5f72f Document %use smartalign 2008-09-03 15:03:20 -07:00
H. Peter Anvin
4a532bc707 Document %unmacro 2008-09-03 14:31:20 -07:00
H. Peter Anvin
fafb6a50e2 outcoff: stylistic cleanups
Don't use explicit L's for things which are really size_t; not only is
it unnecessarily ugly, but it's wrong in a lot of ways.  Do some other
minor stylistic cleanups.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-02 12:56:39 -07:00
H. Peter Anvin
c00c897df7 outcoff: default output symbols to T_NULL
We would leave the output symbol type uninitialized.  Explicitly
initialize it to zero (T_NULL, meaning no symbol type information),
since that's what was effectively done.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2008-09-02 12:55:35 -07:00
H. Peter Anvin
91fb6f1626 BR 2048950: fix crash due to mmacro list overflow
When allocating the buffer for an mmacro list, we apparently failed to
guarantee space for the terminating NULL.  This almost certainly
caused the crash described in BR 2048950, and quite possibly BR
1284169.
2008-09-01 10:56:33 -07:00