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>
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>
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>
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>
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>
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>
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>
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.
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.
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>
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>
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>
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>
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>
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>
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>
H. Peter Anvin [Fri, 7 Aug 2009 16:16:47 +0000 (09:16 -0700)]
Merge commit 'cyr/hpa-dat'
H. Peter Anvin [Fri, 7 Aug 2009 16:16:19 +0000 (09:16 -0700)]
Merge commit 'cyr/hpa-list'
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>
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>
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>
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>
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>
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>
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>
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>
H. Peter Anvin [Thu, 30 Jul 2009 22:06:47 +0000 (15:06 -0700)]
Merge commit 'cyr/hpa-list'
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>
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>
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>
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>
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>
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>
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>
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>
H. Peter Anvin [Sun, 26 Jul 2009 22:42:09 +0000 (15:42 -0700)]
Merge branch 'nasm-2.07.xx'
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>
H. Peter Anvin [Sun, 26 Jul 2009 22:31:59 +0000 (15:31 -0700)]
Merge branch 'nasm-2.07.xx'
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>
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>
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>
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>
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>
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>
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>
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>
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>
H. Peter Anvin [Mon, 20 Jul 2009 05:36:44 +0000 (22:36 -0700)]
Merge branch 'new-preproc'
H. Peter Anvin [Mon, 20 Jul 2009 05:16:52 +0000 (22:16 -0700)]
NASM 2.07
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>
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>
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>
H. Peter Anvin [Sun, 19 Jul 2009 01:43:28 +0000 (18:43 -0700)]
Run make alldeps
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>
H. Peter Anvin [Fri, 17 Jul 2009 04:55:17 +0000 (00:55 -0400)]
Merge commit 'nasm-2.07rc7' into new-preproc
H. Peter Anvin [Fri, 17 Jul 2009 04:35:58 +0000 (00:35 -0400)]
NASM 2.07rc7
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>
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>
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>
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>
Keith Kanios [Fri, 17 Jul 2009 02:13:10 +0000 (21:13 -0500)]
outform.h: update comments regarding macho32/macho64
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>
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>
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>
H. Peter Anvin [Thu, 16 Jul 2009 14:18:43 +0000 (10:18 -0400)]
Merge branch 'master' into new-preproc
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>
H. Peter Anvin [Wed, 15 Jul 2009 20:33:25 +0000 (16:33 -0400)]
NASM 2.07rc6
H. Peter Anvin [Wed, 15 Jul 2009 20:32:49 +0000 (16:32 -0400)]
Merge branch 'master' into new-preproc
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>
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>
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>
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>
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>
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>
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>
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>
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>
H. Peter Anvin [Wed, 15 Jul 2009 13:08:28 +0000 (09:08 -0400)]
NASM 2.07rc5
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>
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
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>
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>
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>
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>
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>
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>
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
H. Peter Anvin [Tue, 14 Jul 2009 01:41:33 +0000 (21:41 -0400)]
Merge branch 'master' into new-preproc
Conflicts:
.gitignore
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>
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>
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>
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>
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>
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>
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>
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>
Keith Kanios [Sun, 12 Jul 2009 05:19:55 +0000 (00:19 -0500)]
preproc: add %exitmacro support and clean up recursive macro handling
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
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
Keith Kanios [Sat, 11 Jul 2009 11:18:43 +0000 (06:18 -0500)]
preproc: fix potential bug regarding MMacro->prev and %rep