platform/upstream/nasm.git
14 years agoassemble: treat register operands without size as wildcards
H. Peter Anvin [Mon, 5 Oct 2009 21:08:05 +0000 (14:08 -0700)]
assemble: treat register operands without size as wildcards

Register with no size are a bit special: we don't honor extrinsic
register sizes in the first place ("oword xmm1" gives a warning,
even), and they should match any xmmrm size.  As such, explicitly
handle sizeless register operands as a hard match, instead of relying
on the fuzzy-matching mechanism to handle them.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agonasm.nsi: use "delete recursively" specificator
Cyrill Gorcunov [Sun, 27 Sep 2009 12:00:06 +0000 (16:00 +0400)]
nasm.nsi: use "delete recursively" specificator

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonsis.nsi: add VS8 rules file to install
Cyrill Gorcunov [Sat, 26 Sep 2009 07:21:20 +0000 (11:21 +0400)]
nsis.nsi: add VS8 rules file to install

Add "VS8 intergartion" section with appropriate
files to be installed on user request.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc/nasmdoc.src: NASMENV -- fixup backslashes
Cyrill Gorcunov [Fri, 25 Sep 2009 21:06:18 +0000 (01:06 +0400)]
doc/nasmdoc.src: NASMENV -- fixup backslashes

−i option (include file search directories) should
contain trailing slash.

Reported-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoVisual Studio 2008 NASM integration
Henry Tumblin [Fri, 25 Sep 2009 14:25:57 +0000 (18:25 +0400)]
Visual Studio 2008 NASM integration

Add integration rules in order to use NASM
seamlessly in your VS2k8.

Signed-off-by: Henry Tumblin <htumblin@users.sourceforge.net>
Signed-off-by: Frank Kotler <fbkotler@zytor.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasm.nsi: fixup shortcut target on nasm manual
Cyrill Gorcunov [Wed, 23 Sep 2009 19:33:11 +0000 (23:33 +0400)]
nasm.nsi: fixup shortcut target on nasm manual

There is no "manual.pdf" but "nasmdoc.pdf" instead.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasm.nsi: fixup output name
Cyrill Gorcunov [Wed, 23 Sep 2009 17:29:57 +0000 (21:29 +0400)]
nasm.nsi: fixup output name

Sigh... It should be PACKAGE_SHORT_NAME
rather then PRODUCT_SHORT_NAME.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasm.nsi: set compressor before MUI macros
Cyrill Gorcunov [Wed, 23 Sep 2009 17:14:32 +0000 (21:14 +0400)]
nasm.nsi: set compressor before MUI macros

MULTIUSER_MUI may set own compressor so we
need to set it earlies to success.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agomisc/release: *.ico are binary files
H. Peter Anvin [Wed, 23 Sep 2009 16:54:10 +0000 (09:54 -0700)]
misc/release: *.ico are binary files

Zip needs to know which files to treat as binary, so tell it *.ico are
binary files.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agonasm.nsi: restore old output name and compressor
Cyrill Gorcunov [Wed, 23 Sep 2009 16:43:34 +0000 (20:43 +0400)]
nasm.nsi: restore old output name and compressor

Othrewise build robot fails

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasm.nsi: do not define VERSION twice
Cyrill Gorcunov [Wed, 23 Sep 2009 13:45:01 +0000 (17:45 +0400)]
nasm.nsi: do not define VERSION twice

VERSION is already defined in version.nsh
no need to define it araing otherwise nsis
compiler fails.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agosubstitute nasm.nsi with new nasm2.nsi
Cyrill Gorcunov [Mon, 21 Sep 2009 19:15:55 +0000 (23:15 +0400)]
substitute nasm.nsi with new nasm2.nsi

We always have "restore point" but such an action will
allow us to test new installer in more wide audience.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonsis2: prepare for substitution
Cyrill Gorcunov [Mon, 21 Sep 2009 19:13:48 +0000 (23:13 +0400)]
nsis2: prepare for substitution

- We need to change slashes to direct ones
- Installer file should be postfixed with plain "-installer"
- Remove nasm.exe duplication

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoNew NSIS script
Cyrill Gorcunov [Mon, 14 Sep 2009 19:17:03 +0000 (23:17 +0400)]
New NSIS script

Lets start using new NSIS features like
Modern UI2, Multiuser install.

The file named nasm2.nsi by purpose -- we should
_not_ break existing functionality.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoelf,stabs: stabs32/64_generate -- append ending token
Cyrill Gorcunov [Mon, 14 Sep 2009 18:10:08 +0000 (22:10 +0400)]
elf,stabs: stabs32/64_generate -- append ending token

This represent "end of compilation unit" token.
Since gcc does (almost) the same lets be on the
same side.

Though to be precise gcc puts offset which points
to the first byte right after the last instruction
issued but in fact string index is analyzed only
so we may safely write zero here (without relocation
as well).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutput/elfcommon.h: tab/space cleanup
Cyrill Gorcunov [Sun, 6 Sep 2009 11:25:35 +0000 (15:25 +0400)]
output/elfcommon.h: tab/space cleanup

No change on binary level

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutput/outelf32.c: code style simplification
Cyrill Gorcunov [Thu, 3 Sep 2009 16:16:28 +0000 (20:16 +0400)]
output/outelf32.c: code style simplification

1) nasm_free is safe against NULL passed so call
   it without test

2) dwarf32_output: check for debug_immcall early
   and get out of procedure if success. This allow
   us to move code blocks left removing indents.

3) dwarf32_findfile and dwarf32_findsect: no need
   for 'else' when 'if' target is plain return.
   Move code blocks left removing indents.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutput/outelf32.c: tab-space cleanup
Cyrill Gorcunov [Thu, 3 Sep 2009 16:02:33 +0000 (20:02 +0400)]
output/outelf32.c: tab-space cleanup

Together with a small style nitpicking.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutput/elf64.h: tab-space cleanup
Cyrill Gorcunov [Thu, 3 Sep 2009 15:10:55 +0000 (19:10 +0400)]
output/elf64.h: tab-space cleanup

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutput/elf32.h: tab-space cleanup
Cyrill Gorcunov [Thu, 3 Sep 2009 15:06:04 +0000 (19:06 +0400)]
output/elf32.h: tab-space cleanup

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutput/outelf.h - tab-space cleanup
Cyrill Gorcunov [Thu, 3 Sep 2009 15:04:23 +0000 (19:04 +0400)]
output/outelf.h - tab-space cleanup

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoUse I_none opcode instead of hardcoded number
Cyrill Gorcunov [Sun, 16 Aug 2009 08:00:01 +0000 (12:00 +0400)]
Use I_none opcode instead of hardcoded number

Consolidate I_none opcode to be used everywhere
instead of mix (-1,I_none).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoUse fputs instead of fprintf for plain strings
Victor van den Elzen [Thu, 13 Aug 2009 13:07:59 +0000 (15:07 +0200)]
Use fputs instead of fprintf for plain strings

LLVM's Clang warns about this. outieee.c had a real problem.

14 years agoFix some format strings for nasm_error
Victor van den Elzen [Tue, 11 Aug 2009 00:10:16 +0000 (02:10 +0200)]
Fix some format strings for nasm_error

Added a format attribute to nasm_error (only for GCC) and
used the resulting warnings to fix some format strings.

14 years agooutput/dwarf.h: update dwarf constants
Cyrill Gorcunov [Mon, 10 Aug 2009 19:56:42 +0000 (23:56 +0400)]
output/dwarf.h: update dwarf constants

There is a hope we'll be supporting dwarf in full form in future. So
I've encoded the standard constants (though binutils uses some
additional codes).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoAdd strlcpy() function
H. Peter Anvin [Mon, 10 Aug 2009 22:56:52 +0000 (15:56 -0700)]
Add strlcpy() function

Add strlcpy() function and implementation, and use configure to detect
if strlcpy() is natively available on the system.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agooutput: change null_debug_routine to null_debug_directive
H. Peter Anvin [Sun, 9 Aug 2009 20:02:35 +0000 (13:02 -0700)]
output: change null_debug_routine to null_debug_directive

This is the null implementation of the function debug_directive.  For
some reason it ended up getting mangled as "null_debug_routine".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agodisasm.c: eatbyte -- use snprintf to prevent potential buffer overflow
Cyrill Gorcunov [Sun, 9 Aug 2009 15:25:29 +0000 (19:25 +0400)]
disasm.c: eatbyte -- use snprintf to prevent potential buffer overflow

At moment we can't overrun buffer even if we would like to
but better to stay on a safe side and use snprintf.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoheaders/c: strip off useless spaces
Cyrill Gorcunov [Sun, 9 Aug 2009 15:09:39 +0000 (19:09 +0400)]
headers/c: strip off useless spaces

All other templates do not have them
so lets unify the approach.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoinsns.pl: remove redundant empty line in enum opcode
Cyrill Gorcunov [Sat, 8 Aug 2009 12:03:01 +0000 (16:03 +0400)]
insns.pl: remove redundant empty line in enum opcode

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agonasm.c: fix stack overrun in assemble_file
H. Peter Anvin [Sat, 8 Aug 2009 20:49:00 +0000 (13:49 -0700)]
nasm.c: fix stack overrun in assemble_file

If [DEBUG id] has id longer then 80 symbols (well, 79 actually plus
EOS) then stack will be just overwritten.

Fix it with explicit check for identifier being too long.

Based on an initial version by Cyrill Gorcunov <gorcunov@gmail.com>.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge commit 'cyr/hpa-dat'
H. Peter Anvin [Fri, 7 Aug 2009 16:16:47 +0000 (09:16 -0700)]
Merge commit 'cyr/hpa-dat'

14 years agoMerge commit 'cyr/hpa-list'
H. Peter Anvin [Fri, 7 Aug 2009 16:16:19 +0000 (09:16 -0700)]
Merge commit 'cyr/hpa-list'

14 years agoinsns.dat -- convert FMA instructions
Cyrill Gorcunov [Fri, 7 Aug 2009 05:44:54 +0000 (09:44 +0400)]
insns.dat -- convert FMA instructions

Convert FMA instructions to explicit sized ones.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoinsns.dat -- convert AVX instructions part2
Cyrill Gorcunov [Fri, 7 Aug 2009 05:24:59 +0000 (09:24 +0400)]
insns.dat -- convert AVX instructions part2

Convert Intel AVX instructions to explisit size
format. Part 2.

Also CLMUL converted as well.

Btw, VPINSR was a bit broken since SB constraint
is not applied on all forms but requires 16,32,64
memory sizes too. Fixed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoinsns.dat -- convert AVX instructions part1
Cyrill Gorcunov [Thu, 6 Aug 2009 20:26:54 +0000 (00:26 +0400)]
insns.dat -- convert AVX instructions part1

Convert Intel AVX instructions to explisit size
format. Part 1.

Also SAR instruction is touched as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agodoc: \ needs to be repeated except in \c-line context; daily snapshots
H. Peter Anvin [Sun, 2 Aug 2009 21:16:07 +0000 (14:16 -0700)]
doc: \ needs to be repeated except in \c-line context; daily snapshots

Fix case where \\ needs to be written as \\\\ in order to appear as a
double backslash.  Also add mention of release candidates and
snapshots.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agooutput/outbin.c -- use list helpers
Cyrill Gorcunov [Sat, 1 Aug 2009 19:52:25 +0000 (23:52 +0400)]
output/outbin.c -- use list helpers

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasm.c: consistently use the 'murrican spelling "optimize"
H. Peter Anvin [Fri, 31 Jul 2009 15:03:32 +0000 (08:03 -0700)]
nasm.c: consistently use the 'murrican spelling "optimize"

"Optimise" (and other -ise words) is en_GB, "optimize" (and other
"-ize" words) is en_US.  Stick to en_US since that is what we seens to
be using more already.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agonasm.1 -- update contents
Cyrill Gorcunov [Fri, 31 Jul 2009 10:30:33 +0000 (14:30 +0400)]
nasm.1 -- update contents

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agonasm.c -- update info on -O cmdline option
Cyrill Gorcunov [Fri, 31 Jul 2009 06:26:55 +0000 (10:26 +0400)]
nasm.c -- update info on -O cmdline option

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoMerge commit 'cyr/hpa-list'
H. Peter Anvin [Thu, 30 Jul 2009 22:06:47 +0000 (15:06 -0700)]
Merge commit 'cyr/hpa-list'

14 years agonasm.c -- update help message
Cyrill Gorcunov [Thu, 30 Jul 2009 20:32:17 +0000 (00:32 +0400)]
nasm.c -- update help message

Show all options we support at moment
via "nasm -h" invoked.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agooutaout.c -- use list helpers
Cyrill Gorcunov [Tue, 28 Jul 2009 19:26:12 +0000 (23:26 +0400)]
outaout.c -- use list helpers

Note that we use list_for_each(var,var) sometime
which actually brings in at least one redundant
assignment in case of NULL being passed but save
us a few lines of code.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoinsns.dat: operand-size syntax for XOP instructions
Cyrill Gorcunov [Mon, 27 Jul 2009 22:49:11 +0000 (15:49 -0700)]
insns.dat: operand-size syntax for XOP instructions

Explicitly declare the sizes of immediate fields.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoassemble.c -- use list helpers
Cyrill Gorcunov [Mon, 27 Jul 2009 18:33:59 +0000 (22:33 +0400)]
assemble.c -- use list helpers

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoassemble.c: quiet warning
H. Peter Anvin [Mon, 27 Jul 2009 18:10:33 +0000 (11:10 -0700)]
assemble.c: quiet warning

Clear an uninitialized variable warning.  The case can't actually
happen, but the compiler doesn't know that.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agonasm.c -- use list helpers
Cyrill Gorcunov [Mon, 27 Jul 2009 12:26:26 +0000 (16:26 +0400)]
nasm.c -- use list helpers

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoinsns.dat -- operand-size syntax for XOP instructions
Cyrill Gorcunov [Mon, 27 Jul 2009 08:32:30 +0000 (12:32 +0400)]
insns.dat -- operand-size syntax for XOP instructions

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
14 years agoassemble.c: clean up matches()
H. Peter Anvin [Sun, 26 Jul 2009 23:25:38 +0000 (16:25 -0700)]
assemble.c: clean up matches()

Simplify matches(), and quite possibly make it more correct.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMerge branch 'nasm-2.07.xx'
H. Peter Anvin [Sun, 26 Jul 2009 22:42:09 +0000 (15:42 -0700)]
Merge branch 'nasm-2.07.xx'

14 years agoBR 2826669: update licensing information in README
H. Peter Anvin [Sun, 26 Jul 2009 22:40:38 +0000 (15:40 -0700)]
BR 2826669: update licensing information in README

The code is now under the 2-clause BSD license.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoMerge branch 'nasm-2.07.xx'
H. Peter Anvin [Sun, 26 Jul 2009 22:31:59 +0000 (15:31 -0700)]
Merge branch 'nasm-2.07.xx'

14 years agoBR 2827397: fix invalid C in outcoff AddExports()
H. Peter Anvin [Sun, 26 Jul 2009 22:29:09 +0000 (15:29 -0700)]
BR 2827397: fix invalid C in outcoff AddExports()

The construct:

         if (i == nsects)
             directive_sec =
                 sects[coff_make_section
                       (EXPORT_SECTION_NAME, EXPORT_SECTION_FLAGS)];

... where coff_make_section() can change the global variable "sects"
is undefined C, since there is no sequence point involved in the []
operator, and it is therefore fully permitted for the C compiler to
read the sects variable first.  Change this construct into two
statements to enforce defined behavior; this also ends up with the
code slightly simpler.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
14 years agoinsns.pl: smarter handling of operand flags
H. Peter Anvin [Sun, 26 Jul 2009 19:52:22 +0000 (12:52 -0700)]
insns.pl: smarter handling of operand flags

Handle operand flags like "xmmrm128" correctly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoassemble: defer "operand size missing" until end of type check
H. Peter Anvin [Sun, 26 Jul 2009 02:12:10 +0000 (19:12 -0700)]
assemble: defer "operand size missing" until end of type check

Defer the "operand size missing" error until we know all the other
operands have the correct type.  Otherwise we'll end up with false
positives, which result in noise entered into the xsizeflags array,
thus causing fuzzy matching to fail.

It's possible we should defer it even further.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoEnable fuzzy matching of operand sizes
H. Peter Anvin [Sun, 26 Jul 2009 01:15:28 +0000 (18:15 -0700)]
Enable fuzzy matching of operand sizes

This allows automatic fuzzy matching of operand sizes.  If an operand
size is not specified, but there is exactly one possible size for the
instruction, select that instruction size.  This requires a second
pass through the instruction patterns, and so is slightly slower, but
should be a lot easier to get right than the S- flags, and works even
when there is more than one instruction.

The new SX (Size eXact) flag can be used to prevent fuzzy matching
completely.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoassemble: move the instruction-matching loop into a common function
H. Peter Anvin [Sun, 26 Jul 2009 00:44:25 +0000 (17:44 -0700)]
assemble: move the instruction-matching loop into a common function

Move the instruction-matching loop into a common function.  This gives
us a single point to adjust the instruction-selection algorithm.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoassemble: replace random integers with an enum for match results
H. Peter Anvin [Sun, 26 Jul 2009 00:25:11 +0000 (17:25 -0700)]
assemble: replace random integers with an enum for match results

Match results were reported with random integers.  Replace with an
enum.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agosync.c - introduce swap_sync helper
Cyrill Gorcunov [Sat, 11 Jul 2009 14:37:08 +0000 (18:37 +0400)]
sync.c - introduce swap_sync helper

Just to remove code duplication

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agopreproc.c - remove redundant assignment
Cyrill Gorcunov [Sat, 11 Jul 2009 13:31:21 +0000 (17:31 +0400)]
preproc.c - remove redundant assignment

There is no need for tline assignment right
before it'll be assigned again in for() cycle.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agonasmlib.h - introduce list iterator helpers
Cyrill Gorcunov [Sat, 11 Jul 2009 13:28:42 +0000 (17:28 +0400)]
nasmlib.h - introduce list iterator helpers

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
15 years agoMerge branch 'new-preproc'
H. Peter Anvin [Mon, 20 Jul 2009 05:36:44 +0000 (22:36 -0700)]
Merge branch 'new-preproc'

15 years agoNASM 2.07
H. Peter Anvin [Mon, 20 Jul 2009 05:16:52 +0000 (22:16 -0700)]
NASM 2.07

15 years agoDrop efunc and evalfunc as input to the preprocessor
H. Peter Anvin [Sun, 19 Jul 2009 01:57:16 +0000 (18:57 -0700)]
Drop efunc and evalfunc as input to the preprocessor

We only ever invoked the preprocessor with fixed values for efunc and
evalfunc, so call nasm_error() and evaluate() directly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoDrop efunc and evaluate argument to parse_line()
H. Peter Anvin [Sun, 19 Jul 2009 01:49:55 +0000 (18:49 -0700)]
Drop efunc and evaluate argument to parse_line()

We never invoked the parser with anything but the default definitions
for evaluate and efunc.  Unlike the backend, though, we sometimes
invoke parse_line() with redefine_label() instead of define_label().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoDrop the ofmt and errfunc arguments to label definition functions
H. Peter Anvin [Sun, 19 Jul 2009 01:31:41 +0000 (18:31 -0700)]
Drop the ofmt and errfunc arguments to label definition functions

We never set ofmt and errfunc to anything but the global values.
Dropping them from the label definition function command line
simplifies the code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoRun make alldeps
H. Peter Anvin [Sun, 19 Jul 2009 01:43:28 +0000 (18:43 -0700)]
Run make alldeps

15 years agoRemove function pointers in output, simplify error handling
H. Peter Anvin [Sun, 19 Jul 2009 01:07:17 +0000 (21:07 -0400)]
Remove function pointers in output, simplify error handling

Remove a bunch of function pointers in the output stage; they are
never changed and don't add any value.  Also make "ofile" a global
variable and let the backend use it directly.

All we ever did with these variables were stashing it in locals and
using them as-is anyway for no benefit.

Also change the global error function, nasm_error() into a true
function which invokes a function pointer internally.  That lets us
use direct calls to it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge commit 'nasm-2.07rc7' into new-preproc
H. Peter Anvin [Fri, 17 Jul 2009 04:55:17 +0000 (00:55 -0400)]
Merge commit 'nasm-2.07rc7' into new-preproc

15 years agoNASM 2.07rc7
H. Peter Anvin [Fri, 17 Jul 2009 04:35:58 +0000 (00:35 -0400)]
NASM 2.07rc7

15 years agooutcoff: fix invalid reference to ofmt
H. Peter Anvin [Fri, 17 Jul 2009 02:46:34 +0000 (22:46 -0400)]
outcoff: fix invalid reference to ofmt

ofmt is a static in nasm.c (why?), not a global...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agotest/Makefile: add more output rules
H. Peter Anvin [Fri, 17 Jul 2009 02:44:43 +0000 (22:44 -0400)]
test/Makefile: add more output rules

Add more output rules to be able to try things quickly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agooutcoff: this is COFF, not binary
H. Peter Anvin [Fri, 17 Jul 2009 02:44:19 +0000 (22:44 -0400)]
outcoff: this is COFF, not binary

Fix error message in outcoff to say COFF, not binary format...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoBR 2822263: don't re-invoke ofmt->symdef() in pass2 unless "special"
H. Peter Anvin [Fri, 17 Jul 2009 02:32:33 +0000 (22:32 -0400)]
BR 2822263: don't re-invoke ofmt->symdef() in pass2 unless "special"

Before checkin aeb0e0e9f1e7e9b32a8f17f2259311f6e9207aa6 we would only
invoke ofmt->symdef() for a common variable during pass 2 if that
variable had "special" in the declaration.  That checkin
unintentionally changed that behavior.

That doesn't mean that the pre-existing behavior is right, but this
should at least fix the resulting regressions.  This really warrants
more investigation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agooutform.h: update comments regarding macho32/macho64
Keith Kanios [Fri, 17 Jul 2009 02:13:10 +0000 (21:13 -0500)]
outform.h: update comments regarding macho32/macho64

15 years agoxcrcgen: tool to create a "generalized CRC" hash table
H. Peter Anvin [Thu, 16 Jul 2009 14:43:38 +0000 (10:43 -0400)]
xcrcgen: tool to create a "generalized CRC" hash table

A so-called "generalized CRC" is a form of hash function based on a
table similar to the conventional bytewise software implementation of
CRC.  For each byte in each data set, it contains a random
byte permutation table.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocrcgen: clean up whitespace
H. Peter Anvin [Thu, 16 Jul 2009 14:23:26 +0000 (10:23 -0400)]
crcgen: clean up whitespace

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agocrcgen: utility program to generate CRC tables
H. Peter Anvin [Thu, 16 Jul 2009 14:20:14 +0000 (10:20 -0400)]
crcgen: utility program to generate CRC tables

Small utility program to generate CRC tables in both C and Perl
formats.  Note: we don't actually need a true CRC, which is what this
generates.  We may want to consider going to a "generalized CRC",
meaning a randomly generated set of 8 bytewise permutations.  These
have the advantage of not being linear, while having the same software
implementation as a true CRC.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' into new-preproc
H. Peter Anvin [Thu, 16 Jul 2009 14:18:43 +0000 (10:18 -0400)]
Merge branch 'master' into new-preproc

15 years agochanges: it's not just invalid UTF-8 sequences that are affected...
H. Peter Anvin [Wed, 15 Jul 2009 21:43:32 +0000 (17:43 -0400)]
changes: it's not just invalid UTF-8 sequences that are affected...

It isn't just invalid UTF-8 sequences that are affected; it is in fact
any high-bit bytes (we don't ever try to construct UTF-8 characters,
just deconstruct them.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNASM 2.07rc6
H. Peter Anvin [Wed, 15 Jul 2009 20:33:25 +0000 (16:33 -0400)]
NASM 2.07rc6

15 years agoMerge branch 'master' into new-preproc
H. Peter Anvin [Wed, 15 Jul 2009 20:32:49 +0000 (16:32 -0400)]
Merge branch 'master' into new-preproc

15 years agochanges: document fixed crash on invalid UTF-8 sequences
H. Peter Anvin [Wed, 15 Jul 2009 20:31:55 +0000 (16:31 -0400)]
changes: document fixed crash on invalid UTF-8 sequences

Document nasm_quote() fixes.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoquote: use nasm_assert() instead of plain assert()
H. Peter Anvin [Wed, 15 Jul 2009 20:28:43 +0000 (16:28 -0400)]
quote: use nasm_assert() instead of plain assert()

We have nasm_assert() now, so use it...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoquote: we must do unsigned comparison to get length of octal escape
H. Peter Anvin [Wed, 15 Jul 2009 20:22:47 +0000 (16:22 -0400)]
quote: we must do unsigned comparison to get length of octal escape

When computing the length of an octal escape, we need to do an
unsigned compare, otherwise we only allocate space for one character
for bytes in the \200..\377 range, which is obviously incorrect.

Reported-by: Ed Beroset <beroset@mindspring.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoquote: don't use sprintf()
H. Peter Anvin [Tue, 14 Jul 2009 18:48:26 +0000 (14:48 -0400)]
quote: don't use sprintf()

There is no point in using sprintf(), and it adds the possibility of
either bugs due to the output not matching what the byte count loop is
expecting, or just cause people to freak out due to the notion that
"sprinf is unsafe".

Reported-by: Ed Beroset <beroset@mindspring.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoquote: use nasm_assert() instead of plain assert()
H. Peter Anvin [Wed, 15 Jul 2009 20:28:43 +0000 (16:28 -0400)]
quote: use nasm_assert() instead of plain assert()

We have nasm_assert() now, so use it...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoquote: we must do unsigned comparison to get length of octal escape
H. Peter Anvin [Wed, 15 Jul 2009 20:22:47 +0000 (16:22 -0400)]
quote: we must do unsigned comparison to get length of octal escape

When computing the length of an octal escape, we need to do an
unsigned compare, otherwise we only allocate space for one character
for bytes in the \200..\377 range, which is obviously incorrect.

Reported-by: Ed Beroset <beroset@mindspring.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agodoc: use consistent title case
H. Peter Anvin [Wed, 15 Jul 2009 13:27:10 +0000 (09:27 -0400)]
doc: use consistent title case

Section titles are in title case and don't end with a period.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agodoc: fix formatting of the bin multisection header
H. Peter Anvin [Wed, 15 Jul 2009 13:21:01 +0000 (09:21 -0400)]
doc: fix formatting of the bin multisection header

"Multisection" is not a keyword...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopreproc: style cleanups
H. Peter Anvin [Wed, 15 Jul 2009 13:16:54 +0000 (09:16 -0400)]
preproc: style cleanups

Fix indentation, space between if and (, and prefer (foo) and (!foo)
to (foo != NULL) and (foo == NULL).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNASM 2.07rc5
H. Peter Anvin [Wed, 15 Jul 2009 13:08:28 +0000 (09:08 -0400)]
NASM 2.07rc5

15 years agopreproc: formatting cleanups
H. Peter Anvin [Wed, 15 Jul 2009 13:07:29 +0000 (09:07 -0400)]
preproc: formatting cleanups

Fix inconsistent indentation, and legacy use of partial directives
instead of simply pp_directives[i].

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopptok: change %rimacro to %irmacro
Keith Kanios [Wed, 15 Jul 2009 02:00:40 +0000 (21:00 -0500)]
pptok: change %rimacro to %irmacro
preproc: change PP_RIMACRO to PP_IRMACRO
nasmdoc: add entries for %[i]deftok and %[i]rmacro

15 years agopreproc: don't pass an enum to %s
H. Peter Anvin [Tue, 14 Jul 2009 19:17:11 +0000 (15:17 -0400)]
preproc: don't pass an enum to %s

Need to use pp_directives[directive], not the plain directive, which
is an enum.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopreproc: generic solution for error on NUL characters in string
H. Peter Anvin [Tue, 14 Jul 2009 19:14:05 +0000 (15:14 -0400)]
preproc: generic solution for error on NUL characters in string

Strings returned by nasm_unquote() can contain NUL characters, which
will not be legal if then used as a C string.  Create a general
function which looks for NUL characters in the string and issues an
error if they are found.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopreproc: reject NUL characters in %deftok directives
H. Peter Anvin [Tue, 14 Jul 2009 19:04:04 +0000 (15:04 -0400)]
preproc: reject NUL characters in %deftok directives

We could either error out or convert them to whitespace; this
implements the error option.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoquote: don't use sprintf()
H. Peter Anvin [Tue, 14 Jul 2009 18:48:26 +0000 (14:48 -0400)]
quote: don't use sprintf()

There is no point in using sprintf(), and it adds the possibility of
either bugs due to the output not matching what the byte count loop is
expecting, or just cause people to freak out due to the notion that
"sprinf is unsafe".

Reported-by: Ed Beroset <beroset@mindspring.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoDon't try to fclose() the output if ofile is NULL
H. Peter Anvin [Tue, 14 Jul 2009 18:47:41 +0000 (14:47 -0400)]
Don't try to fclose() the output if ofile is NULL

ofile == NULL means no output file is open, so don't try to close the
output file if that is true.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>