platform/upstream/nasm.git
14 years agodoc: Fix ..sym section name misprint
Cyrill Gorcunov [Mon, 26 Jul 2010 21:48:27 +0000 (01:48 +0400)]
doc: Fix ..sym section name misprint

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoassemble.c: Style nitfix
Cyrill Gorcunov [Mon, 26 Jul 2010 19:14:40 +0000 (23:14 +0400)]
assemble.c: Style nitfix

Various tabs/space mixture cleaned and some more.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoRevert "Improve process_ea and introduce -OL"
H. Peter Anvin [Sun, 25 Jul 2010 19:43:30 +0000 (12:43 -0700)]
Revert "Improve process_ea and introduce -OL"

This reverts commit ac732cb6a599836bf4c988e59ac6de4498758c72.

Resolved Conflicts:

doc/nasmdoc.src

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agonasm.h: move "regs.h" to top; make is_register() a bool
H. Peter Anvin [Sun, 25 Jul 2010 07:17:12 +0000 (00:17 -0700)]
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>
14 years agomove is_register helper to nasm.h
Cyrill Gorcunov [Sun, 25 Jul 2010 07:09:56 +0000 (11:09 +0400)]
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>
14 years agoUse is_register helper
Cyrill Gorcunov [Sat, 24 Jul 2010 21:16:33 +0000 (01:16 +0400)]
Use is_register helper

Save us some line of code

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoregs.pl: Introduce is_register() helper
Cyrill Gorcunov [Sat, 24 Jul 2010 21:10:17 +0000 (01:10 +0400)]
regs.pl: Introduce is_register() helper

Instead of opencoded check use inline helper.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoRemove redundant sentence in docs
Victor van den Elzen [Sat, 24 Jul 2010 20:24:15 +0000 (22:24 +0200)]
Remove redundant sentence in docs

14 years agoImprove process_ea and introduce -OL
Victor van den Elzen [Tue, 31 Mar 2009 02:59:44 +0000 (04:59 +0200)]
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.

14 years agodoc: Update changes.src
Cyrill Gorcunov [Fri, 23 Jul 2010 14:57:40 +0000 (18:57 +0400)]
doc: Update changes.src

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.: Fix NULL dereference on broken %strlen argument
Cyrill Gorcunov [Fri, 23 Jul 2010 14:51:51 +0000 (18:51 +0400)]
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>
14 years agopreproc: allow non-identifier character in environment variables
H. Peter Anvin [Tue, 20 Jul 2010 21:56:30 +0000 (14:56 -0700)]
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>
14 years agochanges.src: Fix misprint in "instructions" word.
Cyrill Gorcunov [Sat, 17 Jul 2010 14:24:13 +0000 (18:24 +0400)]
changes.src: Fix misprint in "instructions" word.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasmdoc: we still miss Chuck, but...
H. Peter Anvin [Fri, 16 Jul 2010 05:51:26 +0000 (22:51 -0700)]
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>
14 years agoMerge branch 'nasm-2.08.xx'
H. Peter Anvin [Fri, 16 Jul 2010 05:45:04 +0000 (22:45 -0700)]
Merge branch 'nasm-2.08.xx'

Resolved Conflicts:
version

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agochanges.src: update with the 2.08.xx changes
H. Peter Anvin [Fri, 16 Jul 2010 05:44:03 +0000 (22:44 -0700)]
changes.src: update with the 2.08.xx changes

Patchlevels should be documented, too...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoNASM 2.09rc4
H. Peter Anvin [Fri, 16 Jul 2010 01:32:32 +0000 (18:32 -0700)]
NASM 2.09rc4

14 years agoMake -Ox the default
H. Peter Anvin [Fri, 16 Jul 2010 01:28:52 +0000 (18:28 -0700)]
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>
14 years agoDocumentation: describe %ifenv and friends
Bryant Keller [Tue, 13 Jul 2010 19:49:39 +0000 (23:49 +0400)]
Documentation: describe %ifenv and friends

Signed-off-by: Bryant Keller <bkeller@assembly.ath.cx>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc: add %ifenv
H. Peter Anvin [Tue, 13 Jul 2010 19:00:58 +0000 (12:00 -0700)]
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>
14 years agoBR3028880: Revert to nonfatal, better error message, cleanup
H. Peter Anvin [Tue, 13 Jul 2010 18:43:06 +0000 (11:43 -0700)]
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>
14 years agoUpdate changes.src
Cyrill Gorcunov [Tue, 13 Jul 2010 16:59:46 +0000 (20:59 +0400)]
Update changes.src

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3028880: Make nonexistent environment variable being fatal error
Cyrill Gorcunov [Tue, 13 Jul 2010 16:54:48 +0000 (20:54 +0400)]
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>
14 years agoCheck in test for BR3028880
Cyrill Gorcunov [Tue, 13 Jul 2010 16:16:50 +0000 (20:16 +0400)]
Check in test for BR3028880

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3028880: Fix NULL dereference on nonexistent environment variable
Cyrill Gorcunov [Tue, 13 Jul 2010 15:08:15 +0000 (19:08 +0400)]
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>
14 years agotokenize: Fix wrong string index in indirect strings
Cyrill Gorcunov [Tue, 13 Jul 2010 09:32:19 +0000 (13:32 +0400)]
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>
14 years agopreproc: Extract reading line from predefined macros from read_line
Cyrill Gorcunov [Tue, 13 Jul 2010 07:27:41 +0000 (11:27 +0400)]
preproc: Extract reading line from predefined macros from read_line

It makes read_line less complex

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoDocumentation updates
Cyrill Gorcunov [Mon, 12 Jul 2010 19:15:01 +0000 (23:15 +0400)]
Documentation updates

Various small fixes.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNo need for \n at __OUTPUT_FORMAT__ macro end
Cyrill Gorcunov [Mon, 12 Jul 2010 11:19:17 +0000 (15:19 +0400)]
No need for \n at __OUTPUT_FORMAT__ macro end

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge branches 'master' and 'preproc-paste-fix'
Cyrill Gorcunov [Tue, 13 Jul 2010 17:16:05 +0000 (21:16 +0400)]
Merge branches 'master' and 'preproc-paste-fix'

14 years agoBR3026808: Assign to local preprocessor variable does not work in 2.09
Cyrill Gorcunov [Tue, 13 Jul 2010 16:23:34 +0000 (20:23 +0400)]
BR3026808: Assign to local preprocessor variable does not work in 2.09

The commits

20a94ad7fe41c82f77fb670abb68f0de40d2b3e5
29c96651de1c43e59b7db58a4f06ff21dc854125
13dbfad76b4d3dbf27ef41761873584c6bd9fd7f
6f5f7ef417c37c154d10c2b3813808ad3fa65fd7
ddd08c3cccb4b68ecdb24d7a92eab6b2b82e8c68

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

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasmdoc: remove obsolete Sourceforge references
H. Peter Anvin [Sat, 10 Jul 2010 02:04:59 +0000 (19:04 -0700)]
nasmdoc: remove obsolete Sourceforge references

Remove obsolete Sourceforge references, replace with nasm.us.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoNASM 2.09rc3
H. Peter Anvin [Sat, 10 Jul 2010 02:02:28 +0000 (19:02 -0700)]
NASM 2.09rc3

14 years agoNASM 2.08.02
Cyrill Gorcunov [Fri, 9 Jul 2010 22:37:49 +0000 (02:37 +0400)]
NASM 2.08.02

14 years agopreproc.c: Fix NULL deref on token pasting
Cyrill Gorcunov [Fri, 9 Jul 2010 22:11:41 +0000 (02:11 +0400)]
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 adabc1576b957fc7d929d2c7e749b4f45f7293aa]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Fix NULL deref on token pasting
Cyrill Gorcunov [Fri, 9 Jul 2010 22:11:41 +0000 (02:11 +0400)]
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>
14 years agopreproc: add another test case
Cyrill Gorcunov [Fri, 9 Jul 2010 22:05:32 +0000 (15:05 -0700)]
preproc: add another test case

Add another test case for preprocessor token pasting.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agopreproc: don't paste TOK_PREPROC_ID
H. Peter Anvin [Thu, 8 Jul 2010 18:52:57 +0000 (11:52 -0700)]
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>
14 years agoRevert "BR3005117: Expland local single macro before pasting tokens"
H. Peter Anvin [Thu, 8 Jul 2010 15:35:32 +0000 (08:35 -0700)]
Revert "BR3005117: Expland local single macro before pasting tokens"

This reverts commit ec88c1beac003bd6660037da3cef3aebeee7af20.

Revert due to BR 3026808.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoRevert "expand_mmac_params: Don't forget to handle TOK_OTHER"
H. Peter Anvin [Thu, 8 Jul 2010 15:34:41 +0000 (08:34 -0700)]
Revert "expand_mmac_params: Don't forget to handle TOK_OTHER"

This reverts commit 51fd86e0fed8f5162f8c1e45e4ceaf237d6e5539.

Revert due to BR 3026808.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoRevert "expand_mmac_params: Expand local single macros unconditionally"
H. Peter Anvin [Thu, 8 Jul 2010 15:33:47 +0000 (08:33 -0700)]
Revert "expand_mmac_params: Expand local single macros unconditionally"

This reverts commit 1f6741fc78413236816c42d26b34134ab18ba4f1.

Revert due to BR 3026808.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoRevert "expand_mmac_params: Expand local single macros unconditionally"
H. Peter Anvin [Thu, 8 Jul 2010 15:33:14 +0000 (08:33 -0700)]
Revert "expand_mmac_params: Expand local single macros unconditionally"

This reverts commit 985d880c15a5b26e59cdcec4af2eba0748ecfe1f.

Revert due to BR 3026808.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoCheck in test case from bug report br3005117
H. Peter Anvin [Thu, 8 Jul 2010 15:30:23 +0000 (08:30 -0700)]
Check in test case from bug report br3005117

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agobr3026808: add test case
H. Peter Anvin [Thu, 8 Jul 2010 14:31:45 +0000 (07:31 -0700)]
br3026808: add test case

Add test case for BR 3026808 (%assign %$local).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoinsns: add FXSAVE64/FXRSTOR64, drop np prefix
H. Peter Anvin [Thu, 8 Jul 2010 00:20:19 +0000 (17:20 -0700)]
insns: add FXSAVE64/FXRSTOR64, drop np prefix

Add FXSAVE64 and FXRSTOR64; drop the np prefix on 0F AE instructions:
none of the rest of the 0F AE instructions have them, and there are no
conflicts.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMerge branch 'master' of ssh://repo.or.cz/srv/git/nasm
H. Peter Anvin [Thu, 8 Jul 2010 00:17:30 +0000 (17:17 -0700)]
Merge branch 'master' of ssh://repo.or.cz/srv/git/nasm

14 years agoinsns.dat: add XSAVE/XRSTOR64, XSAVEOPT, VCVTPH2PS/VCVTPS2PH
H. Peter Anvin [Wed, 7 Jul 2010 20:48:14 +0000 (13:48 -0700)]
insns.dat: add XSAVE/XRSTOR64, XSAVEOPT, VCVTPH2PS/VCVTPS2PH

Add XSAVE64/XRSTOR64 (previously missing), XSAVEOPT/XSAVEOPT64 (per
AVX 007 spec), and VCVTPH2PS/VCVTPS2PH (per AVX 007) spec.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoinsns.dat: remove VCVTPH2PS/VCVTPS2PH as AMD instructions
H. Peter Anvin [Wed, 7 Jul 2010 02:38:35 +0000 (19:38 -0700)]
insns.dat: remove VCVTPH2PS/VCVTPS2PH as AMD instructions

Remove VCVTPH2PS/VCVTPS2PH as AMD instructions based on version 3.04
of the AMD spec.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoNASM 2.09rc2
H. Peter Anvin [Tue, 6 Jul 2010 22:06:51 +0000 (15:06 -0700)]
NASM 2.09rc2

14 years agodoc: Update changes.src
Cyrill Gorcunov [Tue, 6 Jul 2010 21:48:33 +0000 (01:48 +0400)]
doc: Update changes.src

Before soon-coming 2.09rc2.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoinsns.dat: fix CPU flags for new instructions
H. Peter Anvin [Tue, 6 Jul 2010 16:23:24 +0000 (09:23 -0700)]
insns.dat: fix CPU flags for new instructions

FUTURE is a CPU level flag, and cannot be combined with X64 (which is
shorthand for X86_64,LONG).  Also, make sure we add LONG annotations
to everything that is 64-bit mode only.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoAdd RD*SBASE, WR*SBASE, RDRAND from AVX v7
H. Peter Anvin [Tue, 6 Jul 2010 16:15:48 +0000 (09:15 -0700)]
Add RD*SBASE, WR*SBASE, RDRAND from AVX v7

Add the RD*SBASE, WR*SBASE and RDRAND instructions from version 7 of
the AVX specification, Intel document 319433-007.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agooutbin: Cleanup bin_cleanup
Cyrill Gorcunov [Tue, 6 Jul 2010 15:40:02 +0000 (19:40 +0400)]
outbin: Cleanup bin_cleanup

No need for 'q' variable.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutbin: Simplify reverse address computing
Cyrill Gorcunov [Tue, 6 Jul 2010 15:08:28 +0000 (19:08 +0400)]
outbin: Simplify reverse address computing

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3025702: outbin -- Fix byte ordering
Cyrill Gorcunov [Tue, 6 Jul 2010 14:33:29 +0000 (18:33 +0400)]
BR3025702: outbin -- Fix byte ordering

In commit 55ae12052cd1 we occasionally broke byte ordering. Fix it.
Note that current stable version 2.08.01 is not affected by this bug.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc: inslist.src is an intermediate file, move to "make clean"
H. Peter Anvin [Fri, 25 Jun 2010 20:38:49 +0000 (13:38 -0700)]
doc: inslist.src is an intermediate file, move to "make clean"

inslist.src is an intermediate file, it should be in "make clean"
rather than "make spotless"; otherwise it ends up in the xdoc tarball.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoBR 3020760: insns.dat -- confirm push imm32 on x86-64 explicitly
Cyrill Gorcunov [Fri, 25 Jun 2010 11:45:19 +0000 (15:45 +0400)]
BR 3020760: insns.dat -- confirm push imm32 on x86-64 explicitly

PUSH imm64 confuses ones who is trying to find this instruction in
processor programming manuals.

Actually it was introduced in a sake of "push `size' imm" consistency.
In other words -- to allow users to state "PUSH qword imm32" in 64bit code,
though on byte level (ie generated) code it still has a correct and valid
sign-extended "PUSH imm32" instruction.

To get rid of this ambiguie bite we make explicit "PUSH imm32"
being valid in 64bit code. This also makes "PUSH dword imm32"
valid in 64bit code as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Get rid of signed/unsigned comparison warning
Cyrill Gorcunov [Sat, 19 Jun 2010 21:52:19 +0000 (01:52 +0400)]
preproc.c: Get rid of signed/unsigned comparison warning

We need mac->nparam being explicictly int'fied otherwise
compiler issue a warning. Note that we might have been
using unsigned int but it would break an ability to pass
negative indices.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR 3018233: handle LFS, LGS and LSS with a 64-bit register
H. Peter Anvin [Fri, 18 Jun 2010 23:24:46 +0000 (16:24 -0700)]
BR 3018233: handle LFS, LGS and LSS with a 64-bit register

LFS, LGS and LSS are valid in 64-bit mode and have 64-bit (REX.W)
forms.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoopenwcom.mak: drop /f from delete commands
H. Peter Anvin [Tue, 15 Jun 2010 17:49:09 +0000 (10:49 -0700)]
openwcom.mak: drop /f from delete commands

Classic DOS doesn't have del /f, and we don't really need it.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoRename filenames to 8.3 format
H. Peter Anvin [Tue, 15 Jun 2010 17:47:16 +0000 (10:47 -0700)]
Rename filenames to 8.3 format

Apparently some people still care about compiling native on MS-DOS,
and we don't have a significant number of files which need adjustment.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoexpand_mmac_params: Expand local single macros unconditionally
Cyrill Gorcunov [Tue, 8 Jun 2010 14:45:06 +0000 (18:45 +0400)]
expand_mmac_params: Expand local single macros unconditionally

Peter proposed to expand local single macros unconditionally.
This should not hurt but give us more cleaner code in result.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoexpand_mmac_params: Expand local single macros unconditionally
Cyrill Gorcunov [Tue, 8 Jun 2010 14:39:56 +0000 (18:39 +0400)]
expand_mmac_params: Expand local single macros unconditionally

Peter proposed to expand local single macros unconditionally.
This should not hurt but give us more cleaner code in result.

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutobj: handle compilers without 64-bit switch() support
H. Peter Anvin [Mon, 7 Jun 2010 18:34:28 +0000 (11:34 -0700)]
outobj: handle compilers without 64-bit switch() support

OpenWatcom, in particular, doesn't handle switch() statements with
64-bit expressions, sigh.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agooutelf32: handle compilers without 64-bit switch() support
H. Peter Anvin [Mon, 7 Jun 2010 18:26:11 +0000 (11:26 -0700)]
outelf32: handle compilers without 64-bit switch() support

OpenWatcom, in particular, doesn't handle switch() statements with
64-bit expressions, sigh.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoNASM 2.09rc1
Cyrill Gorcunov [Sat, 5 Jun 2010 20:13:43 +0000 (00:13 +0400)]
NASM 2.09rc1

14 years agonasmdoc: Document macro parameters range
Cyrill Gorcunov [Sat, 5 Jun 2010 07:24:59 +0000 (11:24 +0400)]
nasmdoc: Document macro parameters range

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoexpand_mmac_params_range: Simplify condition
Cyrill Gorcunov [Sat, 5 Jun 2010 06:47:10 +0000 (10:47 +0400)]
expand_mmac_params_range: Simplify condition

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Fix argument indices checking in parameters range
Cyrill Gorcunov [Fri, 4 Jun 2010 21:58:10 +0000 (01:58 +0400)]
preproc.c: Fix argument indices checking in parameters range

Otherwise %{-1:-1} fails.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Introduce macros parameters range expansion
Cyrill Gorcunov [Fri, 4 Jun 2010 21:50:23 +0000 (01:50 +0400)]
preproc.c: Introduce macros parameters range expansion

Introduce an ability to expand multi-line macros parameters in
a range/sequence manner.

For this purpose a special form is introduced %{x:y} which means to
expand %{x:y} to %{x},%{x+1},%{x+2},...,%{y}.

Both arguments could be negative or positive but MUST NOT be zero.

The arguments take into account possible %rotate as well.

Note that unlike the approach implemented in yasm we refer :-1 as
_last_ argument passed to a macro call, this makes possible to refer
the last element from macro via record as %{-1:-1} which could be
a convenient trick.

Also you can refer the argument in reverse order, ie it's legitime
to write %{5:4}, or even to reverse the all arguments %{-1:1}.

An example

 |
 | %macro mpar 1-*
 |     db %{1:-2}
 | %endmacro
 |
 | mpar 1,2,3,4,5,6

in result we'll get the sequence of 1,2,3,4,5

Reported-by: nasm64developer <nasm64developer@users.sf.net>
Inspired-by: Mathieu Monnier <mathieu.monnier@polytechnique.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoexpand_mmac_params: Format condition
Cyrill Gorcunov [Fri, 4 Jun 2010 05:22:12 +0000 (09:22 +0400)]
expand_mmac_params: Format condition

It's much easier to read aligned

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasmlib: Rename elements() macro to ARRAY_SIZE
Cyrill Gorcunov [Thu, 3 Jun 2010 18:04:36 +0000 (22:04 +0400)]
nasmlib: Rename elements() macro to ARRAY_SIZE

ARRAY_SIZE is a well known name pointing out that
we're dealing with array in macro argument.

Also to be on a safe side prefix_name helper should
check the index been in bounds more precisely.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agopreproc.c: Use list_ helpers
Cyrill Gorcunov [Wed, 2 Jun 2010 11:57:51 +0000 (15:57 +0400)]
preproc.c: Use list_ helpers

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoexpand_mmac_params: Don't forget to handle TOK_OTHER
Cyrill Gorcunov [Wed, 2 Jun 2010 07:57:05 +0000 (11:57 +0400)]
expand_mmac_params: Don't forget to handle TOK_OTHER

TOK_OTHER is legitime to follow TOK_PREPROC_ID so don't forget to handle it as well.

[ An addition to commit ec88c1beac00 ]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoBR3005117: Expland local single macro before pasting tokens
Cyrill Gorcunov [Tue, 1 Jun 2010 20:59:21 +0000 (00:59 +0400)]
BR3005117: Expland local single macro before pasting tokens

When we have switched to unified token pasting code we loose
backward compatibility. Restore it.

Note that new code MUST not expluatate this facility but rather
use paste macro %+ explicitly.

N.B. this patch is probably the candidate for revert, though
to give it a chance I commit it.

Reported-by: Alexey Dokuchaev
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNew %use package "fp"
H. Peter Anvin [Fri, 7 May 2010 20:42:09 +0000 (13:42 -0700)]
New %use package "fp"

New standard macro package with utility macros for floating-point
constants.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agonasmdoc: document octal/binary floating-point
H. Peter Anvin [Fri, 7 May 2010 20:21:20 +0000 (13:21 -0700)]
nasmdoc: document octal/binary floating-point

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agonasmdoc: add missing comma
H. Peter Anvin [Fri, 7 May 2010 20:14:45 +0000 (13:14 -0700)]
nasmdoc: add missing comma

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agonasmdoc: update the full set of numeric prefix/suffix characters.
H. Peter Anvin [Fri, 7 May 2010 20:12:12 +0000 (13:12 -0700)]
nasmdoc: update the full set of numeric prefix/suffix characters.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agooutobj: update error message
H. Peter Anvin [Fri, 7 May 2010 00:58:46 +0000 (17:58 -0700)]
outobj: update error message

The possible sizes we can encounter are 1, 2, 4, 8... make sure we get
a proper error message.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agooutobj: properly error on unsupported relocations
H. Peter Anvin [Fri, 7 May 2010 00:52:57 +0000 (17:52 -0700)]
outobj: properly error on unsupported relocations

Error out on any relocations not supported by the backend.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agooutelf64: update copyright date
H. Peter Anvin [Fri, 7 May 2010 00:45:39 +0000 (17:45 -0700)]
outelf64: update copyright date

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoELF support for 8-bit relocations
H. Peter Anvin [Thu, 6 May 2010 23:14:00 +0000 (16:14 -0700)]
ELF support for 8-bit relocations

Support 8-bit relocations (OUT_ADDRESS and OUT_REL1ADR) in ELF.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoPermit short intersegment jumps
H. Peter Anvin [Thu, 6 May 2010 22:32:20 +0000 (15:32 -0700)]
Permit short intersegment jumps

Allow an intersegment jump to be short (OUT_REL1ADR) if explicitly
specified so by the user.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoAdd support for one-byte relocations
H. Peter Anvin [Thu, 6 May 2010 22:25:43 +0000 (15:25 -0700)]
Add support for one-byte relocations

Add OUT_REL1ADR (one-byte relative address) and support for
OUT_ADDRESs with size == 1.  Add support for it in
outbin and outdbg.  *It still needs to be added to other backends*,
both the OUT_REL*ADR and OUT_ADDRESS codepaths need to be handled.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
14 years agoMachO: Fix misprinted macho_sectalign
Cyrill Gorcunov [Wed, 28 Apr 2010 19:17:13 +0000 (23:17 +0400)]
MachO: Fix misprinted macho_sectalign

macho_sectalign was occasionally misprinted
with macho_setcalign, fix it. No change on functionality.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoobj: Implement sectalign helper
Cyrill Gorcunov [Sun, 25 Apr 2010 18:00:15 +0000 (22:00 +0400)]
obj: Implement sectalign helper

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agomacho: Implement sectalign handler
Cyrill Gorcunov [Sun, 25 Apr 2010 17:35:09 +0000 (21:35 +0400)]
macho: Implement sectalign handler

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoieee: Fix section index match in sectalign handler
Cyrill Gorcunov [Sun, 25 Apr 2010 13:55:52 +0000 (17:55 +0400)]
ieee: Fix section index match in sectalign handler

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoheaders: Update year
Cyrill Gorcunov [Sun, 25 Apr 2010 08:02:38 +0000 (12:02 +0400)]
headers: Update year

It's 2010 now

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutieee: Implement sectalign handler
Cyrill Gorcunov [Sat, 24 Apr 2010 21:17:11 +0000 (01:17 +0400)]
outieee: Implement sectalign handler

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutbin: Drop current_section variable
Cyrill Gorcunov [Thu, 22 Apr 2010 18:32:17 +0000 (22:32 +0400)]
outbin: Drop current_section variable

There is no need for it anymore.

Reported-by: "H. Peter Anvin" <hpa@linux.intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutbin: Prune ancient format_mode variable
Cyrill Gorcunov [Thu, 22 Apr 2010 18:24:04 +0000 (22:24 +0400)]
outbin: Prune ancient format_mode variable

format_mode is always set to 1 so there is no need to
keep this variable. "Old chicken bit" (c) :)

Reported-by: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoilog2: optimize use of bsr for x86-64
H. Peter Anvin [Thu, 22 Apr 2010 18:02:56 +0000 (11:02 -0700)]
ilog2: optimize use of bsr for x86-64

On x86-64 platforms, we can rely on BSR not changing the destination
operand when the input is zero.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agodoc: use bouncer URLs for the ABI docs
H. Peter Anvin [Wed, 7 Apr 2010 05:40:47 +0000 (22:40 -0700)]
doc: use bouncer URLs for the ABI docs

MSDN can't seem to keep their URLs stable, so use bouncer links
that we can change if necessary.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agobin: Implement sectalign handler
Cyrill Gorcunov [Thu, 22 Apr 2010 12:37:56 +0000 (16:37 +0400)]
bin: Implement sectalign handler

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agocoff: Use IMAGE_SCN_ALIGN_MASK macro
Cyrill Gorcunov [Thu, 22 Apr 2010 11:21:37 +0000 (15:21 +0400)]
coff: Use IMAGE_SCN_ALIGN_MASK macro

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agocoff: Allow alignment greater then 64 bytes on win
Cyrill Gorcunov [Thu, 22 Apr 2010 11:17:35 +0000 (15:17 +0400)]
coff: Allow alignment greater then 64 bytes on win

On win32/64 we have no 64 bytes limit so hit it on
"coff" target only.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agocoff: Fix section alignment computation
Cyrill Gorcunov [Thu, 22 Apr 2010 11:05:19 +0000 (15:05 +0400)]
coff: Fix section alignment computation

Section alignment is broken due to not being
direct "align -> power of two set" mapping but
rather including second addition operation.

Fix it by introducing coff_sectalign_flags helper.
This also allow us to use this helper for getting
rid of open coded computation as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agocoff: Use predefined macros instead of numbers and style fix
Cyrill Gorcunov [Thu, 22 Apr 2010 10:25:21 +0000 (14:25 +0400)]
coff: Use predefined macros instead of numbers and style fix

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>