Commit Graph

1461 Commits

Author SHA1 Message Date
Victor van den Elzen
b916edecf4 BR 560960: warn about trailing garbage in %macro/%ifmacro 2008-07-23 15:14:22 +02:00
Victor van den Elzen
0e857f1fe5 Improve checking and documentation for %ifctx 2008-07-23 13:21:29 +02:00
H. Peter Anvin
bb266eaa4b BR 2023036: MOV reg32,dreg and vice versa are NOLONG
MOV reg32,dreg and MOV dreg,reg32 are NOLONG; in 64-bit mode we always
move to/from reg64.
2008-07-20 14:59:18 -07:00
H. Peter Anvin
0303f3b6f7 Err, "alignr" was really the same as the previous "alignb"
Replace "alignb" with the (slightly more optimized) "alignr" macro,
but keep the name "alignb".
2008-07-20 09:40:14 -07:00
H. Peter Anvin
aad26229b7 Add "alignr" standard macro (using resb)
Add an "alignr" standard macro, for use in BSS (nobits) and absolute
segments.
2008-07-20 09:32:31 -07:00
H. Peter Anvin
a70547f3ae Avoid redundant "const" for macros_t
Don't use a redundant "const" for macros_t (which is const unsigned
char), since OpenWatcom doesn't like it, and I believe it is incorrect
per the C standard.
2008-07-19 21:44:26 -07:00
H. Peter Anvin
289ff7e2a8 BR 2003451: add test case
Add test case for BR 2003451: forwardness leakage between operands.
2008-07-19 21:40:07 -07:00
H. Peter Anvin
1c3277b625 BR 2003451: avoid "forwardness" leaks between operands
Any use of ins->forw_ref that isn't related to control of the
optimizer is fundamentally broken.  Use
operand->opflags & OPERAND_FORWARD instead.  This even has the nice
side benefit of simplifying the code.
2008-07-19 21:38:56 -07:00
Slavik Gnatenko
1b67bd25b2 BR 2010180: outobj: Garbage may be written in a last PUBDEF
The testcase illustrates the problem. After "nasm -f obj
alonesym.nasm"
let's look to dump:

======
PUBDEF386(91) recnum:5, offset:0000005bh, len:03f9h, chksum:bbh(bb)
Group: 0, Seg: 1
00020000h - 'sym0000' Type:0
00020004h - 'sym0001' Type:0
....
00020134h - 'sym0077' Type:0

PUBDEF(90) recnum:6, offset:00000457h, len:000ah, chksum:b6h(b6)
Group: 0, Seg: 1
00000138h - 's' Type:2
0000b600h - '' Type:0
======

The problem is while 's' offset is 20138h it is marked as type 90h not
91h.  The root cause is located in obj_x():

static ObjRecord *obj_x(ObjRecord * orp, uint32_t val)
{
    if (orp->type & 1)
    	orp->x_size = 32;
    if (val > 0xFFFF)
        orp = obj_force(orp, 32);
    if (orp->x_size == 32)
        return (obj_dword(orp, val));
    orp->x_size = 16;
    return (obj_word(orp, val));
}

It sets up x_size and than writes data. In the testcase data are the
offset and this offset overflows a record. In this case the record is
emitted and its x_size is cleared. Because this is last PUBDEF the new
record with only 's' symbol is emitted also but its x_size is not 32
(it's still zero) so obj_fwrite doesn't switch to 91h type.

The problem seems to be very generic and expected to be occurred on
many other record types as well.

        ----

And the fix is simple:

if (orp->x_size == 32)
{
  ObjRecord * nxt = obj_dword(orp, val);
  nxt->x_size = 32; /* x_size is cleared when a record overflows */
  return nxt;
}
2008-07-19 19:27:41 -07:00
H. Peter Anvin
4fb7ed0566 test: more smart alignment test 2008-07-17 14:29:07 -07:00
H. Peter Anvin
7f0ac96fed smartalign: use context-local label
Use a context-local label in the smart align macro.
2008-07-17 14:28:29 -07:00
H. Peter Anvin
ca66ec5eec smartalign: adjust the alignment threshold
Apparently the current recommendation is for a smaller threshold when
using the "generic"-style alignment macros (short jumps are cheaper on
newer CPUs.)

Also change the alignment threshold definition to reflect the maximum
number of padding instead of when to start using jumps.
2008-07-17 14:22:10 -07:00
H. Peter Anvin
1ac41d34ba smartalign: 16-bit generic alignment macros
Smart alignment content for 16-bit "generic" mode
2008-07-17 14:20:06 -07:00
H. Peter Anvin
47b0c2d428 smartalign: 16-bit P6 NOPs
Add 16-bit P6 NOPs
2008-07-17 14:13:53 -07:00
H. Peter Anvin
f5975eead1 smartalign.mac: smart alignments macro package
"%use smartalign" followed by an optional "alignmode" can be used to
enable smart macros.
2008-07-16 14:41:39 -07:00
H. Peter Anvin
a26433db68 preproc: add %un[i]macro, add cleanups
Add %un[i]macro, and a few stylistic cleanups.

Note: unlike %undef, %un[i]macro takes an argument specification,
which must *exactly* match the macro being undefined.  Similarly,
%unimacro has to be used to undefine a macro defined with %imacro, and
vice versa.
2008-07-16 14:40:01 -07:00
H. Peter Anvin
f9a725aeb7 standard.mac: allow non-power-of-2 alignments
Allow aligning to a non-power-of-2 boundary.  It's probably useless,
but doesn't really hurt.
2008-07-16 14:38:58 -07:00
H. Peter Anvin
90e6e811c9 preproc.c: fix %ifn, %elifn
The sense of %ifn and %elifn was reversed due to a bogus nonstandard
return sequence.
2008-07-16 14:38:24 -07:00
Victor van den Elzen
819703afce Fix multipass inline warning (dis/en)abling
Also add a new form: resetting warnings to their original value.
2008-07-16 15:20:56 +02:00
Victor van den Elzen
8f1120ff47 Fix %rep ... %endmacro crash
Also improved a comment and an error message.
2008-07-16 13:41:37 +02:00
Victor van den Elzen
1f1f38bcd0 update tests 2008-07-16 12:20:26 +02:00
Victor van den Elzen
c7deefaa3a fix unitialized variable in eval_strfunc 2008-07-16 12:20:25 +02:00
Victor van den Elzen
c82c372495 Fix fclose bug on error.
Contrary to the comments, the fclose is needed.
Failure to close the file caused remove to fail on Windows.
2008-07-16 12:20:23 +02:00
Victor van den Elzen
1b1522fadf Add a 'make test' target. 2008-07-16 12:20:22 +02:00
Victor van den Elzen
cabec40a39 Improve performtest.pl
Improve arguments and documentation of performtest.pl
Remove carriage returns in .stdout/.stderr so *nix can
read Windows test results
2008-07-16 12:20:21 +02:00
H. Peter Anvin
5506e1fdef changes.src: put \c{...} around macro directives
Put \c{...} around macro directives.  Not the only ones that should
have that, of course, but they were easy to do with search and replace.
2008-07-14 02:54:00 -04:00
H. Peter Anvin
6477f3d315 changes.src: remove double entry for %warning 2008-07-14 02:49:52 -04:00
H. Peter Anvin
04156cd099 Move the revision history into the documentation
Clumsily convert the revision history to nasmdoc format, so it can be
included in the documentation as Appendix C.
2008-07-14 02:45:57 -04:00
H. Peter Anvin
cf6b43476e doc: document packed BCD constants 2008-07-13 15:55:55 -07:00
H. Peter Anvin
bbf769df01 doc: update NASM Version Macros
Clean up and slightly update the section on NASM version macros.
2008-07-13 15:44:25 -07:00
H. Peter Anvin
6621073059 doc: move %error/%warning to a separate section
They don't really belong in the section on conditional assembly.
2008-07-13 15:41:36 -07:00
H. Peter Anvin
31b98f5431 doc: Document %strcat 2008-07-13 15:35:07 -07:00
H. Peter Anvin
79fd43b228 Update CHANGES to current delta from 2.03.x. 2008-07-13 15:25:54 -07:00
H. Peter Anvin
96a6954db4 BR 2017453: indirect jumps in 64-bit mode are implicitly 64 bits
Indirect jumps in 64-bit mode implicitly have 64-bit operand size.
Fix this; the disassembly is still unnecessarily ugly, however.
2008-07-13 15:21:01 -07:00
H. Peter Anvin
570b1c12b6 test: add test of nested %rep, BCD constants, and %warning
Add a test case which has smoked out errors in the handling of nested
%rep, BCD constants, and %warning...
2008-07-13 15:06:55 -07:00
H. Peter Anvin
97b6d5b676 preproc.c: make %warning actually issue a warning...
The calculation of "severity" was buggered up, with the result that
%warning actually issued an error.
2008-07-13 15:05:53 -07:00
H. Peter Anvin
cdc69da37c version.mak for the version Makefile fragment
Be consistent about the naming of the version Makefile fragment.  We
use .mak elsewhere for Makefiles, so use that.
2008-07-13 13:54:47 -07:00
Charles Crayne
a8ef7ab51d Fix Bugs item #2017455 (LTR in long mode)
LTR is valid in long (64-bit) mode, but still uses
16-bit operand, so remove NOLONG restriction.
2008-07-13 12:52:02 -07:00
Charles Crayne
d4200bed8e %EXITREP inside nested %REPs
Apply updated version of fix submitted with feature request 803785.
This fix causes %exitrep to terminate only the innermost %rep block,
and also allows the count for nested blocks to be calculated in the
containing block.
2008-07-12 16:42:33 -07:00
H. Peter Anvin
386866a345 Add version.make to PERLREQ
version.make is produced by a Perl script, and therefore should be in
PERLREQ.
2008-07-05 17:45:01 -07:00
H. Peter Anvin
514c8de2a3 test: simple test of packed BCD. 2008-07-03 20:16:40 -07:00
H. Peter Anvin
63ebf1650c For consistency, allow 0p.. prefix for packed BCD
Allow 0p... to be used as a prefix, for analogy with base conversion.
2008-07-03 20:16:07 -07:00
H. Peter Anvin
45f22924ea float: support packed-BCD constants in 'dt' statements
Support packed-BCD constants in 'dt' statements (and elsewhere 80-bit
floating point is handled), using MASM syntax (terminal 'p').
2008-07-03 20:12:37 -07:00
H. Peter Anvin
5aa689f80d float: fix buffer overrun
Fix a buffer overrun; generally causing hexadecimal constants to be
incorrectly rejected.
2008-07-03 20:11:30 -07:00
H. Peter Anvin
0b826ac316 standard.mac: use anonymous contexts
Use anonymous %push instead of giving a context name.
2008-07-02 18:11:49 -07:00
H. Peter Anvin
11dfa1a5a5 preproc: Allow anonymous contexts
Allow %push and %repl without a context name.  For a lot of uses, it
is only a potential source of namespace pollution.
2008-07-02 18:11:04 -07:00
H. Peter Anvin
accf43334d Permit commas in %strcat 2008-07-01 21:42:08 -07:00
H. Peter Anvin
f26e097304 preproc: %strcat directive to concatenate quoted strings
I noticed there was no sane way to concatenate the contents of quoted
strings, so add the %strcat directive.

These really need to become preprocessor functions at some stage.
2008-07-01 21:26:27 -07:00
H. Peter Anvin
a396a18074 Update the INSTALL file to match current reality 2008-06-28 18:53:55 -07:00
H. Peter Anvin
a50a4449e5 Document case-insensitivity bug. 2008-06-28 18:39:13 -07:00