platform/upstream/nasm.git
15 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>
15 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>
15 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>
15 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'

15 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>
15 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'

15 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>
15 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>
15 years agooutobj: don't fclose() the output
H. Peter Anvin [Tue, 14 Jul 2009 18:47:04 +0000 (14:47 -0400)]
outobj: don't fclose() the output

Missed fclose() in outobj when converting system to global fclose().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopreproc: add %[i]deftok support
Keith Kanios [Tue, 14 Jul 2009 06:04:12 +0000 (01:04 -0500)]
preproc: add %[i]deftok support
pptok: add %deftok and %ideftok preprocessor directives

15 years agoMerge branch 'master' into new-preproc
H. Peter Anvin [Tue, 14 Jul 2009 01:41:33 +0000 (21:41 -0400)]
Merge branch 'master' into new-preproc

Conflicts:
.gitignore

15 years agogitignore: add test results, *.dbg
H. Peter Anvin [Tue, 14 Jul 2009 01:27:21 +0000 (21:27 -0400)]
gitignore: add test results, *.dbg

Add test result directories and *.dbg to gitignore.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoELF: add debug support for TY_YWORD
H. Peter Anvin [Tue, 14 Jul 2009 01:25:36 +0000 (21:25 -0400)]
ELF: add debug support for TY_YWORD

Add debug support for TY_YWORD (256 bits/32 bytes).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoelf32: debug32_typevalue - fix TY_OWORD size
Cyrill Gorcunov [Mon, 13 Jul 2009 20:34:21 +0000 (00:34 +0400)]
elf32: debug32_typevalue - fix TY_OWORD size

TY_OWORD is 8 * TY_WORD = 16 bytes length

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years ago.gitignore: add testresults, a few more version.* versions, *.dbg
H. Peter Anvin [Mon, 13 Jul 2009 18:57:58 +0000 (14:57 -0400)]
.gitignore: add testresults, a few more version.* versions, *.dbg

Update .gitignore.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agodirectives: split global directives from backend-specific ones
H. Peter Anvin [Mon, 13 Jul 2009 18:54:31 +0000 (14:54 -0400)]
directives: split global directives from backend-specific ones

Split out the global directives into a separate section, that allows
the switch() in the main code to be slightly faster.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoHash even backend-specific directives, unify null functions
H. Peter Anvin [Sun, 12 Jul 2009 19:53:49 +0000 (12:53 -0700)]
Hash even backend-specific directives, unify null functions

Hash all directives, even the ones that are backend-specific,
and instead pass the backend an already-parsed directive number.

Furthermore, unify null functions across various backends.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoDon't fclose() the output in the backend
H. Peter Anvin [Sun, 12 Jul 2009 19:11:52 +0000 (12:11 -0700)]
Don't fclose() the output in the backend

We fopen() the output file in common code but fclose() it in the
backend.  This is bad for a variety of reasons:

1. it is generally an awkward interface to change ownership.
2. we should use ferror() to test for write errors, and that is
   better done in common code.
3. it requires more code.
4. we still need to fclose() in common code during error handing.

Thus, move the fclose() of the output out of the backends, and add
fflush() so we can test ferror() on output.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoUse a phash to decode directives
H. Peter Anvin [Sun, 12 Jul 2009 19:04:56 +0000 (12:04 -0700)]
Use a phash to decode directives

We can use a perfect hash to decode directives as well.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopreproc: add %exitmacro support and clean up recursive macro handling
Keith Kanios [Sun, 12 Jul 2009 05:19:55 +0000 (00:19 -0500)]
preproc: add %exitmacro support and clean up recursive macro handling

15 years agopreproc: refine appropriate handling of PP_RMACRO/PP_RIMACRO/PP_MACRO/PP_IMACRO
Keith Kanios [Sat, 11 Jul 2009 19:48:09 +0000 (14:48 -0500)]
preproc: refine appropriate handling of PP_RMACRO/PP_RIMACRO/PP_MACRO/PP_IMACRO

15 years agopptok: add rmacro/rimacro
Keith Kanios [Sat, 11 Jul 2009 19:26:34 +0000 (14:26 -0500)]
pptok: add rmacro/rimacro
preproc: revamp for use with rmacro/rimacro instead of overloading macro/imacro with optional recursion parameter

15 years agopreproc: fix potential bug regarding MMacro->prev and %rep
Keith Kanios [Sat, 11 Jul 2009 11:18:43 +0000 (06:18 -0500)]
preproc: fix potential bug regarding MMacro->prev and %rep

15 years agopreproc: add recursive macro expansion support
Keith Kanios [Sat, 11 Jul 2009 11:08:54 +0000 (06:08 -0500)]
preproc: add recursive macro expansion support

15 years agoNASM 2.07rc4
H. Peter Anvin [Thu, 9 Jul 2009 04:43:34 +0000 (21:43 -0700)]
NASM 2.07rc4

15 years agoDocument macho64 output format
H. Peter Anvin [Thu, 9 Jul 2009 04:32:28 +0000 (21:32 -0700)]
Document macho64 output format

At least mention the 64-bit macho format in the documentation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoRevert "NASM 2.07rc4"
Keith Kanios [Thu, 9 Jul 2009 04:28:31 +0000 (23:28 -0500)]
Revert "NASM 2.07rc4"

This reverts commit 6d67ced3a470202b511dd55d8d5ac0566ac24fd6.

15 years agoNASM 2.07rc4
Keith Kanios [Thu, 9 Jul 2009 04:21:28 +0000 (23:21 -0500)]
NASM 2.07rc4

15 years agomacho64: Manually merge macho64 branch with master branch.
Keith Kanios [Thu, 9 Jul 2009 04:04:52 +0000 (23:04 -0500)]
macho64: Manually merge macho64 branch with master branch.

15 years agooutmacho.c: fix section/relocation alignment issue
Keith Kanios [Wed, 8 Jul 2009 04:09:22 +0000 (23:09 -0500)]
outmacho.c: fix section/relocation alignment issue

15 years agoNASM 2.07rc3
H. Peter Anvin [Tue, 7 Jul 2009 23:09:55 +0000 (16:09 -0700)]
NASM 2.07rc3

15 years agochanges: document listing fix
H. Peter Anvin [Tue, 7 Jul 2009 23:08:56 +0000 (16:08 -0700)]
changes: document listing fix

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopreproc: revert to older form of preprocessor user error messages
H. Peter Anvin [Tue, 7 Jul 2009 23:06:21 +0000 (16:06 -0700)]
preproc: revert to older form of preprocessor user error messages

When the user generates an error via %warning, %error, or %fatal,
treat is as any other error message.  The attempt at making them stand
out really looked ugly when the preprocessor adds additional tracing
information.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopreproc: always reprocess smacros after %+ - pasting
H. Peter Anvin [Tue, 7 Jul 2009 23:00:58 +0000 (16:00 -0700)]
preproc: always reprocess smacros after %+ - pasting

We always need to process %+ at least once, but we also always need to
reprocess smacros after pasting.  The solution to this is to make sure
we always reprocess %+ after the first expansion pass.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agolisting: preserve list file on error, include errors
H. Peter Anvin [Tue, 7 Jul 2009 19:04:12 +0000 (12:04 -0700)]
listing: preserve list file on error, include errors

Instead of removing the list file on error, keep the list file and
include the errors in the list file.  This makes it actually possible
to debug things that involve deep macro recursion, where the line
number is pretty much meaningless.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agooutdbg: be excrutiatingly correct...
H. Peter Anvin [Tue, 7 Jul 2009 17:27:51 +0000 (10:27 -0700)]
outdbg: be excrutiatingly correct...

outdbg is actually a good starting point to make a new backend, so we
really should endeavor to make it do things "right".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agooutdbg: fix OUT_REL*ADR, add OUT_REL8ADR
H. Peter Anvin [Tue, 7 Jul 2009 17:24:52 +0000 (10:24 -0700)]
outdbg: fix OUT_REL*ADR, add OUT_REL8ADR

The OUT_REL*ADR types pass a pointer which points to an int64_t
which then should be truncated down to size.  This matters on
bigendian platforms.

Add OUT_REL8ADR.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agooutbin: be consistent in spelling "Intel hex" with those caps
H. Peter Anvin [Tue, 7 Jul 2009 06:37:00 +0000 (23:37 -0700)]
outbin: be consistent in spelling "Intel hex" with those caps

The documentation uses "Intel hex", with that capitalization (Intel
being a proper noun, hex being descriptive) so make the help message
match.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNASM 2.07rc2
H. Peter Anvin [Tue, 7 Jul 2009 02:28:00 +0000 (19:28 -0700)]
NASM 2.07rc2

15 years agochanges: add Mach-O alignment issue fix
H. Peter Anvin [Tue, 7 Jul 2009 02:27:33 +0000 (19:27 -0700)]
changes: add Mach-O alignment issue fix

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge branch 'master' of git+ssh://repo.or.cz/srv/git/nasm
Keith Kanios [Tue, 7 Jul 2009 02:08:12 +0000 (21:08 -0500)]
Merge branch 'master' of git+ssh://repo.or.cz/srv/git/nasm

15 years agooutmacho: fixed section/relocation alignment issue
Keith Kanios [Tue, 7 Jul 2009 02:07:15 +0000 (21:07 -0500)]
outmacho: fixed section/relocation alignment issue

15 years agochanges: document %+ behavior revert
H. Peter Anvin [Tue, 7 Jul 2009 02:00:08 +0000 (19:00 -0700)]
changes: document %+ behavior revert

Revert to original %+ behavior.  This is what we really wanted in the
first place, except this time we have fixed some bugs.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agopreproc: don't handle %+ until the final phase of smacro expansion
H. Peter Anvin [Tue, 7 Jul 2009 01:48:23 +0000 (18:48 -0700)]
preproc: don't handle %+ until the final phase of smacro expansion

Revert to the earlier behavior of not expanding %+ until the final
phase of smacro expansion.  However, the previous code has:

    if (expanded && paste_tokens(&thead, true)) {

... which would inhibit paste_tokens() if expanded was false on the
first iteration.  However, if expand_mmac_params is not expanding %+,
then we cannot bypass this expansion.  Thus use:

    pasted = paste_tokens(&thead, true);
    if (expanded && pasted) {

... instead.

This seems to work with both Syslinux and x264 usage, and therefore
hopefully should be compatible with earlier versions of NASM.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNASM 2.07rc1
H. Peter Anvin [Mon, 6 Jul 2009 18:29:19 +0000 (11:29 -0700)]
NASM 2.07rc1

15 years agochanges.src: document user-visible changes
H. Peter Anvin [Mon, 6 Jul 2009 18:28:12 +0000 (11:28 -0700)]
changes.src: document user-visible changes

Update user-visible changes so far.  Since I consider the license
change alone to be big enough of a deal to justify a "real" version
number, make this version 2.07.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agodoc: update license and contact information
H. Peter Anvin [Mon, 6 Jul 2009 18:22:58 +0000 (11:22 -0700)]
doc: update license and contact information

Update license information to 2-BSD; update contact information.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agospec: change License to BSD
H. Peter Anvin [Mon, 6 Jul 2009 18:14:38 +0000 (11:14 -0700)]
spec: change License to BSD

The appropriate License tag for the 2-clause BSD license is... wait
for it... "BSD".  Make it so.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agonasm.nsi: remove COPYING; add LICENSE
H. Peter Anvin [Mon, 6 Jul 2009 18:10:42 +0000 (11:10 -0700)]
nasm.nsi: remove COPYING; add LICENSE

The licensing information has been moved into file LICENSE.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoNASM: relicense under the 2-clause BSD license
H. Peter Anvin [Mon, 6 Jul 2009 18:09:11 +0000 (11:09 -0700)]
NASM: relicense under the 2-clause BSD license

*To the best of my knowledge*, we now have authorization from everyone
who has significantly contributed to NASM in the past.  As such,
change the license to the 2-clause BSD license.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agooutbin: minor cleanups
H. Peter Anvin [Mon, 6 Jul 2009 17:58:37 +0000 (10:58 -0700)]
outbin: minor cleanups

- add assert so we don't try to write 2^64 bytes of zero
- explicitly track the Intel hex "LBA" (64K page) instead of playing
  games with the last byte written.  This way it is more explicit
  what we're doing and why.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoBR 2817225: don't overrun a permts buffer with a maximum label
H. Peter Anvin [Mon, 6 Jul 2009 05:15:57 +0000 (22:15 -0700)]
BR 2817225: don't overrun a permts buffer with a maximum label

BR 677841 was fixed backwards, with a reverse condition.  Correct the
direction of the fix, and add an assert for the overflow condition.

Note: the bug was non-manifest in previous build, so this is not a
security issue.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agonasm.nsi: in the "NASM shell", put NASM first in PATH
H. Peter Anvin [Mon, 6 Jul 2009 02:33:41 +0000 (19:33 -0700)]
nasm.nsi: in the "NASM shell", put NASM first in PATH

In the "NASM shell", it makes sense for NASM to be first in the PATH,
not last.  That way if the user has more than one version of NASM
installed, and one of them is global, the "NASM shell" for any one
version will still pick up the proper version.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoChange noreturn macro to no_return to avoid header file problems
H. Peter Anvin [Mon, 6 Jul 2009 02:22:28 +0000 (19:22 -0700)]
Change noreturn macro to no_return to avoid header file problems

Change the "noreturn" macro to "no_return", to avoid problems with
system header files which use __attribute__((noreturn)) rather than
__attribute__((__noreturn__)) as is appropriate for system headers.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agonasm.nsi: use LZMA compression
H. Peter Anvin [Mon, 6 Jul 2009 02:17:07 +0000 (19:17 -0700)]
nasm.nsi: use LZMA compression

Using LZMA compression produces a significantly smaller installer
binary.

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