Commit Graph

1794 Commits

Author SHA1 Message Date
H. Peter Anvin
89cee57ad0 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>
2009-07-15 09:16:54 -04:00
H. Peter Anvin
db8f96e0e6 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>
2009-07-15 09:07:29 -04:00
Keith Kanios
d37a38c359 pptok: change %rimacro to %irmacro
preproc: change PP_RIMACRO to PP_IRMACRO
nasmdoc: add entries for %[i]deftok and %[i]rmacro
2009-07-14 21:00:40 -05:00
H. Peter Anvin
cd0943e277 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>
2009-07-14 15:17:11 -04:00
H. Peter Anvin
f9c9a6717c 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>
2009-07-14 15:14:05 -04:00
H. Peter Anvin
2f55bdaaca 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>
2009-07-14 15:04:04 -04:00
H. Peter Anvin
466ba97d68 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>
2009-07-14 14:48:26 -04:00
H. Peter Anvin
bf0247af7a 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>
2009-07-14 14:47:41 -04:00
H. Peter Anvin
68bec0872f 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>
2009-07-14 14:47:04 -04:00
Keith Kanios
b83fd0b947 preproc: add %[i]deftok support
pptok: add %deftok and %ideftok preprocessor directives
2009-07-14 01:04:12 -05:00
H. Peter Anvin
340ee009d6 Merge branch 'master' into new-preproc
Conflicts:
	.gitignore
2009-07-13 21:41:33 -04:00
H. Peter Anvin
44a0d177f0 gitignore: add test results, *.dbg
Add test result directories and *.dbg to gitignore.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-13 21:27:21 -04:00
H. Peter Anvin
2a3154c4d3 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>
2009-07-13 21:25:36 -04:00
Cyrill Gorcunov
e3042cb103 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>
2009-07-13 17:19:21 -04:00
H. Peter Anvin
ad01495da8 .gitignore: add testresults, a few more version.* versions, *.dbg
Update .gitignore.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-13 14:57:58 -04:00
H. Peter Anvin
80e0f4d68f 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>
2009-07-13 14:57:48 -04:00
H. Peter Anvin
afa06137fa 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>
2009-07-12 12:55:24 -07:00
H. Peter Anvin
d0fbb7f0ab 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>
2009-07-12 12:15:35 -07:00
H. Peter Anvin
323fcff32b 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>
2009-07-12 12:04:56 -07:00
Keith Kanios
852f1eeed5 preproc: add %exitmacro support and clean up recursive macro handling 2009-07-12 00:19:55 -05:00
Keith Kanios
093513d0bc preproc: refine appropriate handling of PP_RMACRO/PP_RIMACRO/PP_MACRO/PP_IMACRO 2009-07-11 14:48:09 -05:00
Keith Kanios
0af5ee2732 pptok: add rmacro/rimacro
preproc: revamp for use with rmacro/rimacro instead of overloading macro/imacro with optional recursion parameter
2009-07-11 14:26:34 -05:00
Keith Kanios
8059902f12 preproc: fix potential bug regarding MMacro->prev and %rep 2009-07-11 06:18:43 -05:00
Keith Kanios
891775e5ba preproc: add recursive macro expansion support 2009-07-11 06:08:54 -05:00
H. Peter Anvin
8da1557a3e NASM 2.07rc4 2009-07-08 21:43:34 -07:00
H. Peter Anvin
a6e25b5356 Document macho64 output format
At least mention the 64-bit macho format in the documentation.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-08 21:42:18 -07:00
Keith Kanios
c5a87ba0a1 Revert "NASM 2.07rc4"
This reverts commit 6d67ced3a4.
2009-07-08 23:28:31 -05:00
Keith Kanios
6d67ced3a4 NASM 2.07rc4 2009-07-08 23:21:28 -05:00
Keith Kanios
6d0d0d2736 macho64: Manually merge macho64 branch with master branch. 2009-07-08 23:04:52 -05:00
Keith Kanios
745560e65a outmacho.c: fix section/relocation alignment issue 2009-07-07 23:09:22 -05:00
H. Peter Anvin
52a3fbd74d NASM 2.07rc3 2009-07-07 16:09:55 -07:00
H. Peter Anvin
a7a14b2fcb changes: document listing fix
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-07 16:08:56 -07:00
H. Peter Anvin
931cab64d6 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>
2009-07-07 16:06:21 -07:00
H. Peter Anvin
8287daf2a4 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>
2009-07-07 16:00:58 -07:00
H. Peter Anvin
a23aa4a3e9 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>
2009-07-07 12:04:12 -07:00
H. Peter Anvin
5bc87609d2 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>
2009-07-07 10:27:51 -07:00
H. Peter Anvin
62c0e8379c 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>
2009-07-07 10:24:52 -07:00
H. Peter Anvin
215086ace8 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>
2009-07-06 23:37:00 -07:00
H. Peter Anvin
75639312f0 NASM 2.07rc2 2009-07-06 19:28:00 -07:00
H. Peter Anvin
e227fe6f80 changes: add Mach-O alignment issue fix
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-06 19:27:33 -07:00
Keith Kanios
4e56ad2c09 Merge branch 'master' of git+ssh://repo.or.cz/srv/git/nasm 2009-07-06 21:08:12 -05:00
Keith Kanios
5051c63d7e outmacho: fixed section/relocation alignment issue 2009-07-06 21:07:15 -05:00
H. Peter Anvin
83b942d3e1 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>
2009-07-06 19:00:08 -07:00
H. Peter Anvin
fc30f8c736 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>
2009-07-06 18:48:23 -07:00
H. Peter Anvin
740df43005 NASM 2.07rc1 2009-07-06 11:29:19 -07:00
H. Peter Anvin
fba06d2719 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>
2009-07-06 11:28:12 -07:00
H. Peter Anvin
ecfba9d6ab doc: update license and contact information
Update license information to 2-BSD; update contact information.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-06 11:22:58 -07:00
H. Peter Anvin
460a4fef3a 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>
2009-07-06 11:14:38 -07:00
H. Peter Anvin
4ea9cede34 nasm.nsi: remove COPYING; add LICENSE
The licensing information has been moved into file LICENSE.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-07-06 11:10:42 -07:00
H. Peter Anvin
8ee2e244eb 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>
2009-07-06 11:09:11 -07:00