]> granicus.if.org Git - yasm/log
yasm
18 years agoFix farith and farithp instructions for GAS mode (e.g. fsubr).
Peter Johnson [Thu, 15 Jun 2006 04:55:47 +0000 (04:55 -0000)]
Fix farith and farithp instructions for GAS mode (e.g. fsubr).

The easiest way to fix these was to adjust the GAP input file to have NASM
and GAS versions of these instructions.

Tests added to check both NASM and GAS (farith.asm and gas-farithr.asm
respectively).

svn path=/trunk/yasm/; revision=1579

18 years agoSupport __OUTPUT_FORMAT__ (NASM naming) as alias for __YASM_OBJFMT__.
Peter Johnson [Fri, 9 Jun 2006 02:57:09 +0000 (02:57 -0000)]
Support __OUTPUT_FORMAT__ (NASM naming) as alias for __YASM_OBJFMT__.

Requested by: Mike Frysinger <vapier@gentoo.org>

svn path=/trunk/yasm/; revision=1557

18 years agoFix cross-reference filename/line number. We were reporting (wrongly) the
Peter Johnson [Thu, 8 Jun 2006 04:10:04 +0000 (04:10 -0000)]
Fix cross-reference filename/line number.  We were reporting (wrongly) the
virtual line number rather than the physical filename/line number.  This
was broken when the errwarn code was changed and not caught because I didn't
check the errwarn results closely enough for this case.

* nasm-token.re, gas-token.re: Propagate warnings from arch early.
This is a case where we probably want the double-error/warning on a single
line.

* errwarn.h: Add xref filename to yasm_print_error_func, and document all
parameters.
* errwarn.c: Get the physical file/line for xref virtual line.
* yasm.c: Update to match new yasm_print_error_func definition.

* pushf-err.errwarn: Correct test.

svn path=/trunk/yasm/; revision=1556

18 years ago* x86parse.gap: Make cmpxchg16b only work as an instruction identifer in 64-bit
Peter Johnson [Thu, 8 Jun 2006 03:37:13 +0000 (03:37 -0000)]
* x86parse.gap: Make cmpxchg16b only work as an instruction identifer in 64-bit
mode.

svn path=/trunk/yasm/; revision=1554

18 years agoAdd support for cmpxchg16b.
Peter Johnson [Thu, 8 Jun 2006 03:24:28 +0000 (03:24 -0000)]
Add support for cmpxchg16b.

Noticed by: Cory Nelson <phrosty@gmail.com>

svn path=/trunk/yasm/; revision=1551

18 years agoFix use of arithmetic with single-character constants in data declarations.
Peter Johnson [Thu, 1 Jun 2006 06:40:12 +0000 (06:40 -0000)]
Fix use of arithmetic with single-character constants in data declarations.
Multi-character constants are still not valid, as they are somewhat
difficult to handle without adding some sort of string handling into
yasm_expr.  This fix may break big-endian targets (we don't have any yet).

* nasm-bison.y: Add new token ONECHARSTR.  Add string rule that takes
STRING and ONECHARSTR; use this instead of STRING everywhere but dataval.
In dvexpr, take ONECHARSTR as character constant.
* nasm-token.re: Generate ONECHARSTR for one-character string contants.

Reported by: Robert Riebisch <rr@bttr-software.de>

svn path=/trunk/yasm/; revision=1548

18 years ago* bc-data.c (yasm_bc_create_data): Fix crash on empty string (e.g. db '').
Peter Johnson [Thu, 1 Jun 2006 05:50:27 +0000 (05:50 -0000)]
* bc-data.c (yasm_bc_create_data): Fix crash on empty string (e.g. db '').

svn path=/trunk/yasm/; revision=1547

18 years ago* x86parse.gap: Update pushf generation to match popf for legalization and
Peter Johnson [Mon, 22 May 2006 06:19:04 +0000 (06:19 -0000)]
* x86parse.gap: Update pushf generation to match popf for legalization and
prefix regarding pushfq vs 64-bit mode.
* pushf.asm, pushf-err.asm: New tests for pushf and popf in all modes.

Reported by: Vivek Mohan <vivek.mt@gmail.com>

svn path=/trunk/yasm/; revision=1542

18 years ago* x86id.c: Add support for 64-bit far jmp/call. These are not listed in the
Peter Johnson [Fri, 12 May 2006 02:12:19 +0000 (02:12 -0000)]
* x86id.c: Add support for 64-bit far jmp/call.  These are not listed in the
AMD64 ISA reference but are in the Intel EM64T reference.
* x86arch.h: Add CPU_EM64T flag.
* x86parse.gap: Add CPU_EM64T as feature and enable it as part of "prescott".
* far64.asm: Test for 64-bit far jmp/call.

svn path=/trunk/yasm/; revision=1540

18 years ago* value.c (yasm_value_output_basic): The destsize parameter accidentally got
Peter Johnson [Fri, 12 May 2006 02:00:04 +0000 (02:00 -0000)]
* value.c (yasm_value_output_basic): The destsize parameter accidentally got
out of sync with the header file (should be size_t).

svn path=/trunk/yasm/; revision=1539

18 years agoFix major bug related to multiple handling. Unfortunately this slows down
Peter Johnson [Thu, 11 May 2006 07:00:33 +0000 (07:00 -0000)]
Fix major bug related to multiple handling.  Unfortunately this slows down
bytecode multiple output significantly, but this way handles generating
relocations correctly (otherwise extern foo; times 5 dd foo doesn't work!).

* bytecode.h (yasm_bc_tobytes): Remove multiple output parameter.
(yasm_bc_get_multiple): New.
* bytecode.c (yasm_bc_tobytes): Update to iterate through multiple here.
(yasm_bc_get_multiple): New.
* xdf-objfmt.c, elf-objfmt.c, bin-objfmt.c, coff-objfmt.c: Don't iterate
through multiple here.
* nasm-listfmt.c: Use yasm_bc_get_multiple() to get multiple instead of
yasm_bc_tobytes().

* bytecode.pxi: Update.

* tests/win32-relocovfl.asm: Tests both this and [1534] but generates too
huge of a file (3MB) to be put into the automated tests.

svn path=/trunk/yasm/; revision=1536

18 years ago* coff-objfmt.c: Support >=64K relocs on Win32/64 objects.
Peter Johnson [Thu, 11 May 2006 05:43:22 +0000 (05:43 -0000)]
* coff-objfmt.c: Support >=64K relocs on Win32/64 objects.

svn path=/trunk/yasm/; revision=1535

18 years ago* coretype.h (yasm_value): Add size field (specified in bits).
Peter Johnson [Wed, 10 May 2006 08:54:52 +0000 (08:54 -0000)]
* coretype.h (yasm_value): Add size field (specified in bits).
(yasm_value_output_func): Remove valsize and shift parameters.
* bytecode.h (yasm_effaddr): Remove disp_len, replacing with
need_nonzero_len.
(yasm_immval): Remove len.
* value.h (yasm_value_initialize): Add size parameter.
(yasm_value_finalize_expr): Likewise.
(yasm_value_output_basic): Remove valsize and shift parameters.

Update all implementations and users for the above.

* intnum.c (yasm_intnum_calc): Fix bug in shift right (was doing a logical
instead of arithmetic shift).

* lc3b-basic.asm, lc3b-basic.errwarn, lc3b-basic.hex: Update based on
fixed warnings.

svn path=/trunk/yasm/; revision=1534

18 years ago* Mkfiles: Update to match [1532].
Peter Johnson [Wed, 10 May 2006 04:18:45 +0000 (04:18 -0000)]
* Mkfiles: Update to match [1532].

svn path=/trunk/yasm/; revision=1533

18 years ago* bc-int.h (yasm_bytecode_callback): Add reserve flag to indicate if the
Peter Johnson [Wed, 10 May 2006 04:18:23 +0000 (04:18 -0000)]
* bc-int.h (yasm_bytecode_callback): Add reserve flag to indicate if the
bytecode outputs just space and not data.
* bytecode.pxi: Update to match.
* bytecode.c (yasm_bc_tobytes): Use reserve flag instead of checking
against bytecode_reserve as special case.
* dwarf2-info.c, dwarf2-line.c, dwarf2-dbgfmt.c, cv-symline.c, cv-type.c,
* stabs-dbgfmt.c, lc3bbc.c, x86bc.c: Update to set reserve=0.

* bc-align.c, bc-insn.c, bc-reserve.c, bc-org.c, bc-incbin.c, bc-data.c,
* bytecode.c: Split out bytecodes into separate files.  While we're here,
merge LEB128 into general data bytecode.

svn path=/trunk/yasm/; revision=1532

18 years ago* expr.c (expr_get_item): Refactor itempool code.
Peter Johnson [Tue, 9 May 2006 05:17:44 +0000 (05:17 -0000)]
* expr.c (expr_get_item): Refactor itempool code.

svn path=/trunk/yasm/; revision=1531

18 years agoTry to combine as much data as possible into single raw (used to be string)
Peter Johnson [Mon, 8 May 2006 08:08:15 +0000 (08:08 -0000)]
Try to combine as much data as possible into single raw (used to be string)
dataval data bytecode blocks.  This drastically cuts down on dataval
overhead for large sets of constant data (savings of 30% or more on peak
memory usage in some cases).  We may try to improve this even more down the
road by doing things like combining across multiple data bytecodes and
converting constant instructions into raw bytes.

* bytecode.c (yasm_bc_create_data): Add (optional) yasm_arch operand so that
bytes can be generated from constant values of >1 byte size.  Do as much
simplification to constant raw bytes here as possible.
(bytecode_data): No longer a need to remember append_zero.
(bc_data_resolve, bc_data_output): Update to not handle append_zero.
(yasm_dataval): Rename string to raw.
(yasm_dv_create_string): Rename to:
(yasm_dv_create_raw): Here.

* bytecode.h (yasm_dv_create_string): Change into macro that casts parameters
into yasm_dv_create_raw().
(yasm_dv_create_raw): New.

modules: Update for new yasm_bc_create_data() parameter.

svn path=/trunk/yasm/; revision=1530

18 years ago* expr.c: Don't hit the allocator so hard with tiny temporary requests when
Peter Johnson [Mon, 8 May 2006 07:51:23 +0000 (07:51 -0000)]
* expr.c: Don't hit the allocator so hard with tiny temporary requests when
creating expressions; instead, keep a pool of 31 yasm_expr__items and pull
from those instead of malloc/free'ing.

svn path=/trunk/yasm/; revision=1529

18 years agoAdd/Use helpers to pass void* as manually type-checked PyCObjects.
Michael Urman [Sun, 7 May 2006 18:23:33 +0000 (18:23 -0000)]
Add/Use helpers to pass void* as manually type-checked PyCObjects.

svn path=/trunk/yasm/; revision=1528

18 years agoRework yasm.Expression to accept strings like '+' to indicate operation.
Michael Urman [Sun, 7 May 2006 16:41:16 +0000 (16:41 -0000)]
Rework yasm.Expression to accept strings like '+' to indicate operation.
Add tests for yasm.Expression and new yasm.ImmVal.

svn path=/trunk/yasm/; revision=1527

18 years agoRaise SymbolTable redefinition errors in Python.
Michael Urman [Sun, 7 May 2006 03:22:03 +0000 (03:22 -0000)]
Raise SymbolTable redefinition errors in Python.
Fix a double-free problem encountered during this testing.
Redefine symtab.define_special() vis parameter to match symrec.visibility.

svn path=/trunk/yasm/; revision=1526

18 years ago* errwarn.c (yasm_error_matches): Make real function, fix a bug with checking
Peter Johnson [Sun, 7 May 2006 02:35:50 +0000 (02:35 -0000)]
* errwarn.c (yasm_error_matches): Make real function, fix a bug with checking
against YASM_ERROR_GENERAL errors.
* errwarn.h (yasm_error_matches): Remove #defined function.

svn path=/trunk/yasm/; revision=1525

18 years agoRaise IntNum division by zero errors in Python.
Michael Urman [Sat, 6 May 2006 19:12:05 +0000 (19:12 -0000)]
Raise IntNum division by zero errors in Python.

svn path=/trunk/yasm/; revision=1524

18 years ago* lc3barch.c (lc3b_get_fill): Fix type-punning warning on GCC 4.1.
Peter Johnson [Sat, 6 May 2006 16:11:56 +0000 (16:11 -0000)]
* lc3barch.c (lc3b_get_fill): Fix type-punning warning on GCC 4.1.
* x86arch.c (x86_get_fill): Likewise.
* yasm.c: Fix long-standing warning.

svn path=/trunk/yasm/; revision=1523

18 years ago* errwarn.h (yasm_warn_set, yasm_warn_set_va): Fix doxygen arg list comments.
Peter Johnson [Fri, 5 May 2006 03:02:42 +0000 (03:02 -0000)]
* errwarn.h (yasm_warn_set, yasm_warn_set_va): Fix doxygen arg list comments.

svn path=/trunk/yasm/; revision=1522

18 years agoRevamp error/warning handling, using a model similar to Python's internal
Peter Johnson [Thu, 4 May 2006 07:55:32 +0000 (07:55 -0000)]
Revamp error/warning handling, using a model similar to Python's internal
exception handling.  There are now two layers an error or warning goes
through before it hits the user: first an error is logged via
yasm_error_set() (or yasm_warn_set() for a warning).  Only one error may
be set, whereas multiple warnings can be set (yasm_warn_set maintains a
linked list).  Then, calling yasm_errwarn_propagate() propagates any error
and/or warning(s) to an errwarns structure and associates the
errors/warnings with a line number at that time; this call also clears the
pending errors/warnings and allows new ones to be set.  The propagate
function can safely be called when there are no pending error/warnings.

In addition, there are some helper errwarn functions that allow clearing of
an error/warning without propagating, getting it separately, etc.

Still yet to be done: changing most/all uses of yasm_internal_error() into
yasm_error_set(YASM_ERROR_ASSERTION).

The main advantage this change has is making libyasm functions feel much
more library like, and separating the user code line numbers from the inner
function error handling (e.g. intnum create functions only needed the line
number to trigger errors; this is no longer required).

The set/propagate/etc functions use global data structures to avoid passing
around a pointer to every function.  This would need to be made thread-local
data in a threaded app.  Errwarns containers (that keep associated line
numbers) are no longer global, so multiple source streams can be processed
separately with no conflict (at least if there's only a single thread of
execution).

svn path=/trunk/yasm/; revision=1521

18 years ago* ax_create_stdint_h.m4: Fix a couple bugs.
Peter Johnson [Thu, 4 May 2006 03:59:39 +0000 (03:59 -0000)]
* ax_create_stdint_h.m4: Fix a couple bugs.
The m4_ifvaln() call doesn't seem to serve a purpose and generated bad shell
script code (trying to actually run a header file).
_STDINT_HEADER_INTPTR ifdef shouldn't wrap INTMAX_T check.

svn path=/trunk/yasm/; revision=1519

18 years ago* configure.ac: Don't error-out configure if Python not found; Python is
Peter Johnson [Wed, 3 May 2006 02:47:01 +0000 (02:47 -0000)]
* configure.ac: Don't error-out configure if Python not found; Python is
completely optional.

Noticed by: Stephen Polkowski <stephen@centtech.com>

svn path=/trunk/yasm/; revision=1518

18 years ago* elf.c (elf_strtab_enty_set_str): Update following strtab indices since
Peter Johnson [Sun, 30 Apr 2006 05:50:43 +0000 (05:50 -0000)]
* elf.c (elf_strtab_enty_set_str): Update following strtab indices since
string length can change.  This was breaking symbol name lookups when the
filename was changed (e.g. for dwarf2).
* dwarf32_testhd.hex, dwarf64_leb128.hex: Fix testcases so they're correct.

svn path=/trunk/yasm/; revision=1516

18 years ago* nasm-bison.y (nasm_parser_directive): The objfmt directive must be the last
Peter Johnson [Thu, 27 Apr 2006 03:48:57 +0000 (03:48 -0000)]
* nasm-bison.y (nasm_parser_directive): The objfmt directive must be the last
directive called; thus reorder dbgfmt_directive and objfmt_directive calls.

svn path=/trunk/yasm/; revision=1514

18 years ago* x86id.c (yasm_x86__finalize_insn): Don't check for explicit 64-bit
Peter Johnson [Wed, 26 Apr 2006 06:35:46 +0000 (06:35 -0000)]
* x86id.c (yasm_x86__finalize_insn): Don't check for explicit 64-bit
effective address size in GAS mode.  Doing this breaks movabs.
* gas-movabs.asm: Test this.

svn path=/trunk/yasm/; revision=1512

18 years ago* hamt.c (HAMT_insert): Avoid hash collisions by checking full string on hash
Peter Johnson [Wed, 26 Apr 2006 04:55:01 +0000 (04:55 -0000)]
* hamt.c (HAMT_insert): Avoid hash collisions by checking full string on hash
match.

svn path=/trunk/yasm/; revision=1511

18 years ago* nasm-bison.y: Enable dbgfmt directives from NASM parser. This allows e.g.
Peter Johnson [Tue, 25 Apr 2006 03:42:45 +0000 (03:42 -0000)]
* nasm-bison.y: Enable dbgfmt directives from NASM parser.  This allows e.g.
loc and file DWARF2 directives to be accessed using [loc ...] and [file ...]
just like .loc and .file work from the GAS parser.

svn path=/trunk/yasm/; revision=1509

18 years ago* nasm-token.re: Actually handle $-prefixed names correctly, stripping the $ prefix...
Peter Johnson [Mon, 24 Apr 2006 05:53:26 +0000 (05:53 -0000)]
* nasm-token.re: Actually handle $-prefixed names correctly, stripping the $ prefix and allowing
any combination of characters following.
* win64-dataref.asm: Update to match (has a $-prefixed symbol).

Reported by: Nils Weller <nils@gnulinux.nl>

svn path=/trunk/yasm/; revision=1508

18 years ago* nasm-preproc.c (nasm_preproc_input): Don't generate %line except at the
Peter Johnson [Sat, 22 Apr 2006 04:08:00 +0000 (04:08 -0000)]
* nasm-preproc.c (nasm_preproc_input): Don't generate %line except at the
beginning of a line.  The old way could insert a %line in the middle of very
long lines (e.g. >8192 chars).
* longline.asm: Test with an ~8500 character line.

Reported by: Brian Gladman <brg@gladman.plus.com>

svn path=/trunk/yasm/; revision=1506

18 years ago* gas-bison.y: Handle segment register operands, fixing #74.
Peter Johnson [Tue, 18 Apr 2006 05:52:03 +0000 (05:52 -0000)]
* gas-bison.y: Handle segment register operands, fixing #74.
* gas-push.asm: Test this.

svn path=/trunk/yasm/; revision=1504

18 years ago* symrec.pxi: Change various things to properties rather than functions.
Peter Johnson [Mon, 17 Apr 2006 05:36:47 +0000 (05:36 -0000)]
* symrec.pxi: Change various things to properties rather than functions.
Visibility is handled via set of strings.
* test_symrec.py: Test.

svn path=/trunk/yasm/; revision=1503

18 years ago* python_test.sh: Set srcdir and PYTHON to reasonable defaults if not already
Peter Johnson [Mon, 17 Apr 2006 03:53:04 +0000 (03:53 -0000)]
* python_test.sh: Set srcdir and PYTHON to reasonable defaults if not already
set, this allows easy manual execution of this script outside of make check.

svn path=/trunk/yasm/; revision=1502

18 years ago* python_test.sh: Use PYTHON variable to find python executable.
Peter Johnson [Mon, 17 Apr 2006 03:21:41 +0000 (03:21 -0000)]
* python_test.sh: Use PYTHON variable to find python executable.
* python-yasm/tests/Makefile.inc: Pass PYTHON setting down through
TESTS_ENVIRONMENT.
* Makefile.am: Initialize TESTS_ENVIRONMENT to empty.

svn path=/trunk/yasm/; revision=1501

18 years ago* intnum.c (yasm_intnum_calc): Use BitVector_Compare, not Lexicompare;
Peter Johnson [Mon, 17 Apr 2006 03:06:44 +0000 (03:06 -0000)]
* intnum.c (yasm_intnum_calc): Use BitVector_Compare, not Lexicompare;
intnums are signed, and Compare is the signed comparison function.

svn path=/trunk/yasm/; revision=1500

18 years agoAdd intnum tests; test_cmp is failing right now and needs a source fix.
Michael Urman [Mon, 17 Apr 2006 02:16:50 +0000 (02:16 -0000)]
Add intnum tests; test_cmp is failing right now and needs a source fix.

svn path=/trunk/yasm/; revision=1499

18 years ago* test_symrec.py: Actually add test, and fix it to work.
Peter Johnson [Mon, 17 Apr 2006 02:13:52 +0000 (02:13 -0000)]
* test_symrec.py: Actually add test, and fix it to work.

svn path=/trunk/yasm/; revision=1498

18 years ago* python-yasm: Add test framework; large portions copied from Quod Libet
Peter Johnson [Mon, 17 Apr 2006 02:04:00 +0000 (02:04 -0000)]
* python-yasm: Add test framework; large portions copied from Quod Libet
framework.

svn path=/trunk/yasm/; revision=1497

18 years ago* symrec.pxi: Remove duplicate l.appends() in values() and items().
Peter Johnson [Mon, 17 Apr 2006 01:00:43 +0000 (01:00 -0000)]
* symrec.pxi: Remove duplicate l.appends() in values() and items().

svn path=/trunk/yasm/; revision=1496

18 years ago* symrec.pxi: Implement iterators.
Peter Johnson [Sun, 16 Apr 2006 22:46:22 +0000 (22:46 -0000)]
* symrec.pxi: Implement iterators.
* symrec.h (yasm_symtab_first, yasm_symtab_next, yasm_symtab_iter_value):
Supporting functions.
* symrec.c (yasm_symtab_first, yasm_symtab_next, yasm_symtab_iter_value):
Implement by passing through to...
* hamt.h (HAMT_first, HAMT_next, HAMTEntry_get_data): New.
* hamt.c (HAMT_first, HAMT_next, HAMTEntry_get_data): Implement.

svn path=/trunk/yasm/; revision=1495

18 years agosymrec.pxi: Implement __contains__ so that "'foo' in SymbolTable" works.
Peter Johnson [Sun, 16 Apr 2006 20:28:07 +0000 (20:28 -0000)]
symrec.pxi: Implement __contains__ so that "'foo' in SymbolTable" works.

svn path=/trunk/yasm/; revision=1494

18 years ago* nasm-eval.c (expr5, expr6): Remove unused variables.
Peter Johnson [Sun, 16 Apr 2006 19:18:33 +0000 (19:18 -0000)]
* nasm-eval.c (expr5, expr6): Remove unused variables.

svn path=/trunk/yasm/; revision=1493

18 years ago* floatnum.pxi: yasm_floatnum doesn't support any ops other than NEG,
Peter Johnson [Sun, 16 Apr 2006 08:48:28 +0000 (08:48 -0000)]
* floatnum.pxi: yasm_floatnum doesn't support any ops other than NEG,
other cleanups along the lines of intnum.

svn path=/trunk/yasm/; revision=1492

18 years ago* symrec.pxi: Revamp to more correctly generate Symbol objects, support
Peter Johnson [Sun, 16 Apr 2006 08:41:41 +0000 (08:41 -0000)]
* symrec.pxi: Revamp to more correctly generate Symbol objects, support
most dictionary functions (but not yet iterator protocol).
* yasm.pyx: Add Py_INCREF, Py_DECREF, malloc, free externals.
* coretype.pxi: Rename c_print to print_, add some missing yasm_expr_op
enum values.

svn path=/trunk/yasm/; revision=1491

18 years ago* intnum.pxi: Use correct name for NotImplementedError.
Peter Johnson [Sun, 16 Apr 2006 02:56:54 +0000 (02:56 -0000)]
* intnum.pxi: Use correct name for NotImplementedError.

svn path=/trunk/yasm/; revision=1490

18 years ago* intnum.pxi: Implement full set of integer and comparison functions.
Peter Johnson [Sun, 16 Apr 2006 02:27:01 +0000 (02:27 -0000)]
* intnum.pxi: Implement full set of integer and comparison functions.

svn path=/trunk/yasm/; revision=1489

18 years ago* intnum.c (yasm_intnum_create_sized): New, reverse function of
Peter Johnson [Sat, 15 Apr 2006 09:59:17 +0000 (09:59 -0000)]
* intnum.c (yasm_intnum_create_sized): New, reverse function of
yasm_intnum_get_sized().
* intnum.h (yasm_intnum_create_sized): Prototype.

* yasm.pyx: Bring in _PyLong_From/AsByteArray functions.
* intnum.pyx: Use yasm_intnum_create_sized(), etc to implement full 128-bit
number handling.

* intnum.c (yasm_intnum_get_str): Return strings in hex rather than in
decimal.

svn path=/trunk/yasm/; revision=1488

18 years ago* python-yasm/Makefile.inc: .python_build needs to depend on
Peter Johnson [Sat, 15 Apr 2006 08:43:54 +0000 (08:43 -0000)]
* python-yasm/Makefile.inc: .python_build needs to depend on
libyasm_a_SOURCES otherwise the Python bindings don't get updated when
libyasm changes.

svn path=/trunk/yasm/; revision=1487

18 years ago* python-yasm/Makefile.inc: Since we aren't using buildtools to call Pyrex,
Peter Johnson [Sat, 15 Apr 2006 08:03:42 +0000 (08:03 -0000)]
* python-yasm/Makefile.inc: Since we aren't using buildtools to call Pyrex,
we shouldn't need to remove the build directory.  Not removing it speeds up
the build considerably (we don't have to rebuild all of the Python bindings
just because the Makefile changed, for example).

svn path=/trunk/yasm/; revision=1486

18 years agoChange the NASM preprocessor to use yasm_intnum and yasm_expr. This
Peter Johnson [Sat, 15 Apr 2006 04:06:44 +0000 (04:06 -0000)]
Change the NASM preprocessor to use yasm_intnum and yasm_expr.  This
decreases bloat and more importantly makes it possible to use >32-bit values
in the preprocessor.

This has NOT been heavily tested, so there may easily be bugs.  I've not yet
decided whether to merge this to 0.5.0 final for this reason.

Inspired by: Jason Chen <jchen@centtech.com> patches to use "long long"
rather than "long" in the preprocessor to enable >32-bit values.

* coretype.h (yasm_op): Add XNOR, LXOR, LXNOR, LNOR.
* intnum.c (yasm_intnum_calc): Calculate the above.
* expr.c (expr_is_constant, expr_can_destroy_int_left)
(expr_can_destroy_int_right, ...): Actually handle logical operations,
including the new ones.

* intnum.c (yasm_intnum_get_str): New; gets a signed decimal string
representation of an intnum.
* intnum.h (yasm_intnum_get_str): Prototype.

* nasmlib.c (nasm_strcat): Change parameters to const.
* nasmlib.h (nasm_strcat): Update prototype.

* nasm-preproc.c (nasm_preproc_input): Close a memory leak.

* nasm.h: Clean out a lot of cruft we don't use.
(tokenval): Change t_integer and t_inttwo to yasm_intnums.
(evalfunc): Remove fwref and hints parameters (cleanup), change return value
to yasm_expr.
* nasm-eval.c: Massively rewrite to just call appropriate yasm_expr creation
functions rather than calculating the value here.  Overall recursive descent
parsing structure is unchanged.
* nasmlib.c: Remove a lot of now-unused functions.
(nasm_readnum): Use yasm_intnum functions and return that.
(nasm_readstrnum): Likewise.
* nasmlib.h: Update prototypes.
* nasm-pp.c: Change to use intnum/expr as necessary.
* nasm-preproc.c (nasm_preproc_destroy): Don't call nasm_eval_cleanup,
it's been deleted.

* nasmpp-bigint.asm: New test for >32-bit preproc values.
* ifcritical-err.errwarn: The new code doesn't generate a duplicate warning.

svn path=/trunk/yasm/; revision=1485

18 years agoCorrectly handle input characters >127 by using unsigned char in the re2c
Peter Johnson [Wed, 12 Apr 2006 04:06:44 +0000 (04:06 -0000)]
Correctly handle input characters >127 by using unsigned char in the re2c
tokenizers.  Signed chars >127 are negative, and thus aren't caught by the
[\000-\377] range.
* gas-parser.h (YYCTYPE): Change to unsigned char.
* gas-bison.y, gas-token.re: Cast as necessary to char.
* nasm-parser.h, nasm-bison.y, nasm-token.re: Likewise.
* lc3bid.re: Likewise.

svn path=/trunk/yasm/; revision=1481

18 years ago* ax_create_stdint_h.m4: Don't bother using head -1 to get the first line of
Peter Johnson [Sun, 9 Apr 2006 06:05:37 +0000 (06:05 -0000)]
* ax_create_stdint_h.m4: Don't bother using head -1 to get the first line of
gcc --version; this is just extra information.  POSIX needs -n 1 instead of
-1; instead of dealing with this, just disable this function.

Noticed by: Vikas Kumar <walburn@gmail.com>

svn path=/trunk/yasm/; revision=1480

18 years agoIn dwarf2, don't create symbols that are not in the table but will show up in
Peter Johnson [Sat, 8 Apr 2006 18:32:57 +0000 (18:32 -0000)]
In dwarf2, don't create symbols that are not in the table but will show up in
a relocation.  This can break some object formats (e.g. Win64).

svn path=/trunk/yasm/; revision=1478

18 years agoBump trunk internal version to 0.5.99.0.
Peter Johnson [Fri, 7 Apr 2006 05:13:24 +0000 (05:13 -0000)]
Bump trunk internal version to 0.5.99.0.

svn path=/trunk/yasm/; revision=1476

18 years ago* xstrdup.c: Remove compatibility shims that, due to this file's inclusion in gap...
Peter Johnson [Fri, 7 Apr 2006 01:47:30 +0000 (01:47 -0000)]
* xstrdup.c: Remove compatibility shims that, due to this file's inclusion in gap, broke DJGPP
build.

svn path=/trunk/yasm/; revision=1469

18 years agoTake #2 on reversioning: decouple version and build from autoconf version
Peter Johnson [Thu, 6 Apr 2006 05:55:41 +0000 (05:55 -0000)]
Take #2 on reversioning: decouple version and build from autoconf version
(which is used for the tar.gz name).  Also clean up Mkfiles/config.h

* configure.ac: Change autoconf version back to HEAD, add new PACKAGE_INTVER
and PACKAGE_BUILD config.h defines.
* cv-symline.c, yasm.c: Use PACKAGE_INTVER and PACKAGE_BUILD instead of
PACKAGE_STRING.
* genversion.c: Likewise.

* Mkfiles: Clean up and add PACKAGE_INTVER and PACKAGE_BUILD.

svn path=/trunk/yasm/; revision=1468

18 years ago* Mkfiles: Fix genversion include paths.
Peter Johnson [Thu, 6 Apr 2006 01:54:07 +0000 (01:54 -0000)]
* Mkfiles: Fix genversion include paths.

Thanks to: Brian Gladman for vcproj fixes.

svn path=/trunk/yasm/; revision=1467

18 years ago* Mkfiles: Bring up to date with main tree changes (genstring, genversion).
Peter Johnson [Wed, 5 Apr 2006 07:53:55 +0000 (07:53 -0000)]
* Mkfiles: Bring up to date with main tree changes (genstring, genversion).

svn path=/trunk/yasm/; revision=1466

18 years ago* vc8/config.h, vc/config.h, dj/config.h: Update version information.
Peter Johnson [Wed, 5 Apr 2006 07:16:20 +0000 (07:16 -0000)]
* vc8/config.h, vc/config.h, dj/config.h: Update version information.

svn path=/trunk/yasm/; revision=1465

18 years agoImplement better versioning. From now on, trunk's version will be the
Peter Johnson [Wed, 5 Apr 2006 07:14:41 +0000 (07:14 -0000)]
Implement better versioning.  From now on, trunk's version will be the
current major and minor version but with subminor version = 99.  All releases
and snapshots will have a build version of the current svn version.  Version
information is put into predefined macros in the NASM preproc:
__YASM_MAJOR__, __YASM_MINOR__, __YASM_SUBMINOR__, __YASM_BUILD__,
__YASM_VERSION_ID__, __YASM_VER__.
__YASM_VER__ does not have the build version as part of the string, and
__YASM_VERSION_ID__ does not incorporate the build version.
If the build version is "HEAD" (or other non-numeric), __YASM_BUILD__ is
set to 0.

* configure.ac: Set version to 0.4.99.HEAD for trunk.
* genversion.c: Generate version.mac for the NASM preproc version macros.
* Makefile.inc: Hook into build.

svn path=/trunk/yasm/; revision=1464

18 years ago* COPYING: Update verbiage, add list of contributors and copyright notice.
Peter Johnson [Wed, 5 Apr 2006 05:39:23 +0000 (05:39 -0000)]
* COPYING: Update verbiage, add list of contributors and copyright notice.

* genstring.c: Generate string array from source file.
* Makefile.am: Build genstring.
* Makefile.inc: Use genstring to create license.c from COPYING.
* yasm.c: Include license.c and use it for new --license option.  Shorten
--version option to just displaying version, compile date, and very short
copyright message.

svn path=/trunk/yasm/; revision=1463

18 years ago* setup.py: strip() opts["srcdir"] to unbreak distcheck.
Peter Johnson [Wed, 5 Apr 2006 05:36:06 +0000 (05:36 -0000)]
* setup.py: strip() opts["srcdir"] to unbreak distcheck.

svn path=/trunk/yasm/; revision=1462

18 years ago* setup.py: Incorporate cleanups suggested by Michael Urman.
Peter Johnson [Wed, 5 Apr 2006 03:37:46 +0000 (03:37 -0000)]
* setup.py: Incorporate cleanups suggested by Michael Urman.

svn path=/trunk/yasm/; revision=1461

18 years agoQuiet warnings in Pyrex code by adding "-w" if GCC detected.
Peter Johnson [Wed, 5 Apr 2006 02:26:19 +0000 (02:26 -0000)]
Quiet warnings in Pyrex code by adding "-w" if GCC detected.
* configure.ac: Pass GCC value to Makefile
* Makefile.inc: Pass GCC value to python-setup.txt
* setup.py: Check GCC value and append -w if necessary.

svn path=/trunk/yasm/; revision=1460

18 years ago* Makefile.am: Unbreak build for when Python bindings aren't being built;
Peter Johnson [Wed, 5 Apr 2006 02:05:19 +0000 (02:05 -0000)]
* Makefile.am: Unbreak build for when Python bindings aren't being built;
also more cleanly hook into all target.

svn path=/trunk/yasm/; revision=1459

18 years ago* pyrex.m4: Add a little documentation.
Peter Johnson [Tue, 4 Apr 2006 08:06:39 +0000 (08:06 -0000)]
* pyrex.m4: Add a little documentation.
* setup.py, yasm.pyx, *.pxi: Add copyright/license.

svn path=/trunk/yasm/; revision=1458

18 years agoBe much smarter at checking for and running Pyrex. Pyrex is a Python module
Peter Johnson [Tue, 4 Apr 2006 07:51:42 +0000 (07:51 -0000)]
Be much smarter at checking for and running Pyrex.  Pyrex is a Python module
and the "pyrexc" command is just a wrapper, so instead of looking for
"pyrexc" look for the module instead.

* pyrex.m4: New macro to check Pyrex version.
* m4/Makefile.inc: Add to dist.
* configure.ac: Use macro to check for Pyrex >= 0.9.3.
* python-yasm/Makefile.inc: Run Python directly instead of pyrexc wrapper.

svn path=/trunk/yasm/; revision=1457

18 years agoHook Python module into the build (even though it's pretty incomplete),
Peter Johnson [Tue, 4 Apr 2006 06:07:32 +0000 (06:07 -0000)]
Hook Python module into the build (even though it's pretty incomplete),
enabled with --enable-python (defaults to auto-detect).

Thanks to some magic in python-yasm/Makefile.inc and setup.py, this actually
plays nicely with automake distcheck.

* m4/pythonhead.m4: Script to find Python.h.
* m4/Makefile.inc: Include it in distfiles.
* configure.ac: Add --enable-python option and Python and Pyrex detection.
* tools/Makefile.inc: Pull tools/python-yasm/Makefile.inc into build.
* python-yasm/Makefile.inc: Add automake build magic for extension.
* setup.py: Likewise.

svn path=/trunk/yasm/; revision=1456

18 years ago* bytecode.pxi: Fix definition of yasm_dv_create_string().
Peter Johnson [Tue, 4 Apr 2006 06:02:18 +0000 (06:02 -0000)]
* bytecode.pxi: Fix definition of yasm_dv_create_string().

svn path=/trunk/yasm/; revision=1455

18 years ago* dwarf2-dbgfmt.c, cv-symline.c, nasm-pp.c: Clean up a few unused variables.
Peter Johnson [Tue, 4 Apr 2006 03:46:18 +0000 (03:46 -0000)]
* dwarf2-dbgfmt.c, cv-symline.c, nasm-pp.c: Clean up a few unused variables.

svn path=/trunk/yasm/; revision=1454

18 years ago* value.pxi, expr.pxi: Copy instead of NULL'ing origin; this will look much
Peter Johnson [Mon, 3 Apr 2006 04:54:27 +0000 (04:54 -0000)]
* value.pxi, expr.pxi: Copy instead of NULL'ing origin; this will look much
more pythonic on the python side, although it will cause much additional
object churn, and will not be fast.

svn path=/trunk/yasm/; revision=1453

18 years ago* coretype.h (yasm_output_value_func): Remove splint reference to ep.
Peter Johnson [Mon, 3 Apr 2006 04:39:53 +0000 (04:39 -0000)]
* coretype.h (yasm_output_value_func): Remove splint reference to ep.

svn path=/trunk/yasm/; revision=1452

18 years ago* cv-symline.c (cv_sym_bc_tobytes): Silence signedness warning.
Peter Johnson [Mon, 3 Apr 2006 04:37:23 +0000 (04:37 -0000)]
* cv-symline.c (cv_sym_bc_tobytes): Silence signedness warning.

svn path=/trunk/yasm/; revision=1451

18 years agopython-yasm: Modularize and clean up. Note the modularization is a little
Peter Johnson [Mon, 3 Apr 2006 04:32:25 +0000 (04:32 -0000)]
python-yasm: Modularize and clean up.  Note the modularization is a little
bit broken: you need to remove yasm.c before running python setup.py build
or the pyrex step may not actually run.

svn path=/trunk/yasm/; revision=1450

18 years agoCheckin of initial work on a pyrex python binding for yasm. Very little
Michael Urman [Sun, 2 Apr 2006 08:13:31 +0000 (08:13 -0000)]
Checkin of initial work on a pyrex python binding for yasm. Very little
works so far. Build it with the command {{{python setup.py build}}}, and
optionally symlink to the built yasm.so to enable importing it from a
python started in the same directory.

svn path=/trunk/yasm/; revision=1449

18 years ago* coff-objfmt.c (coff_objfmt_section_switch): Fix up handling of GAS flags
Peter Johnson [Sat, 1 Apr 2006 09:09:53 +0000 (09:09 -0000)]
* coff-objfmt.c (coff_objfmt_section_switch): Fix up handling of GAS flags
a bit; add support for .rodata and .debug sections.
* dwarf2-line.c (yasm_dwarf2__generate_line): Set alignment for .debug_line
explicitly to 1 rather than leaving it implicit.

Fix up testcases to match.

svn path=/trunk/yasm/; revision=1446

18 years ago* yasm.c (version_msg): Update copyright date range.
Peter Johnson [Thu, 30 Mar 2006 04:26:16 +0000 (04:26 -0000)]
* yasm.c (version_msg): Update copyright date range.

svn path=/trunk/yasm/; revision=1442

18 years ago* yasm.rules: Clean up.
Peter Johnson [Thu, 30 Mar 2006 04:21:37 +0000 (04:21 -0000)]
* yasm.rules: Clean up.
* modules.vcproj: Remove PreBuildEvent pointing to build.bat that no longer
exists.

Contributed by: Brian Gladman <brg@gladman.plus.com>

svn path=/trunk/yasm/; revision=1441

18 years ago* yasm.rules: Add debug flag feature as configurable for Visual Studio.
Peter Johnson [Wed, 29 Mar 2006 07:27:20 +0000 (07:27 -0000)]
* yasm.rules: Add debug flag feature as configurable for Visual Studio.

Contributed by: Brian Gladman

svn path=/trunk/yasm/; revision=1440

18 years agoFix a couple bugs in CV8 that generate bad debug info.
Peter Johnson [Wed, 29 Mar 2006 07:24:51 +0000 (07:24 -0000)]
Fix a couple bugs in CV8 that generate bad debug info.

* cv-symline.c (cv_sym_bc_tobytes): Output sym relocation at correct offset relative to bc start.
(cv8_add_sym_compile): Compile flag "symbol" has list of key/values terminated with 0/0; we
weren't doing this.  Like MASM, just output an empty list.
(cv_generate_sym): Default data type to UBYTE rather than nothing.

* cv8.txt: Document compile flag key/value list.

Thanks to: Brian Gladman for his test setup.

svn path=/trunk/yasm/; revision=1439

18 years ago* expr.c (expr_simplify_identity): Fix crash when there are greater than 2
Peter Johnson [Tue, 28 Mar 2006 09:35:44 +0000 (09:35 -0000)]
* expr.c (expr_simplify_identity): Fix crash when there are greater than 2
terms in an expr, only 1 of them is an intnum, and it can get removed.

* expr-wide-ident.asm: Test for this case.

Reported by: Brian Gladman

svn path=/trunk/yasm/; revision=1438

18 years ago* combpath_test.c: Add a couple of tests with drive letters in the mix.
Peter Johnson [Tue, 28 Mar 2006 09:09:15 +0000 (09:09 -0000)]
* combpath_test.c: Add a couple of tests with drive letters in the mix.

svn path=/trunk/yasm/; revision=1437

18 years agoFinally fix brokenness that was NASM imported preprocessor include path
Peter Johnson [Tue, 28 Mar 2006 09:05:53 +0000 (09:05 -0000)]
Finally fix brokenness that was NASM imported preprocessor include path
handling.  The new way of doing things follows C compiler standard path
searching rules in terms of relative and absolute paths in relation to
source location and the current working directory.  There's probably some
latent bugs in this as I've not tested it on Windows yet.

This should make CodeView actually usable with included files.

* file.c (yasm__abspath_win, yasm__abspath_unix): Convert a relative path
into an absolute path.  Code moved from:
* cv-symline.c (cv_make_pathname): Here (deleted).
(cv_dbgfmt_add_file): Use yasm__abspath() instead.
* file.h (yasm__abspath_win, yasm__abspath_unix): Prototype.
(yasm__abspath): Macro pointing to right version.

* file.c (yasm__combpath_win, yasm__combpath_unix): Combine two possibly
relative paths (also handles absolute paths).
* file.h (yasm__combpath_win, yasm__combpath_unix): Prototype.
(yasm__combpath): Macro pointing to right version.

* file.c (yasm__fopen_include): Where the new include search magic happens,
using yasm__combpath heavily.
* file.h (yasm__fopen_include): Prototype.

* nasm-preproc.c: Update to use yasm__fopen_include().
* nasmlib.c (nasm_src_get_fname): Helper.
* nasmlib.h (nasm_src_get_fname): Helper prototype.
* nasm-preproc.c (nasm_preproc_add_dep): Don't free pointer, we need it.

* splitpath_test.c: Update.
* combpath_test.c: New test for yasm__combpath_*.

* Mkfiles: Update config.h for yasm__abspath and yasm__combpath.

svn path=/trunk/yasm/; revision=1436

18 years ago* yasm.c (main): Fix longstanding bug of putting the default object file
Peter Johnson [Tue, 28 Mar 2006 02:37:21 +0000 (02:37 -0000)]
* yasm.c (main): Fix longstanding bug of putting the default object file
output into the source directory rather than the current directory (like
C compilers do).

svn path=/trunk/yasm/; revision=1435

18 years ago* splitpath_test.c: Include file.h not splitpath.c to match [1433].
Peter Johnson [Tue, 28 Mar 2006 02:26:19 +0000 (02:26 -0000)]
* splitpath_test.c: Include file.h not splitpath.c to match [1433].

svn path=/trunk/yasm/; revision=1434

18 years agoIn preparation for more file handling functions to get moved to libyasm,
Peter Johnson [Tue, 28 Mar 2006 02:20:28 +0000 (02:20 -0000)]
In preparation for more file handling functions to get moved to libyasm,
merge splitpath functions into file.c/h.

* splitpath.c: Remove, moving functions to
* file.c: Here.

* coretype.h: Move splitpath prototypes to
* file.h: Here.

* libyasm/Makefile.inc: Update to remove splitpath.c compilation.
* Mkfiles: Likewise.

svn path=/trunk/yasm/; revision=1433

18 years ago* cv-type.c (cv_type_create): Initialize leaves.
Peter Johnson [Tue, 28 Mar 2006 02:08:46 +0000 (02:08 -0000)]
* cv-type.c (cv_type_create): Initialize leaves.

Noticed by: Brian Gladman

svn path=/trunk/yasm/; revision=1432

18 years ago* Mkfiles: Update for CodeView dbgfmt addition.
Peter Johnson [Mon, 27 Mar 2006 05:00:38 +0000 (05:00 -0000)]
* Mkfiles: Update for CodeView dbgfmt addition.

svn path=/trunk/yasm/; revision=1431

18 years ago* cv-type.c: Fix typo (CV_T_PFBOOL32 should be CV_T_PFBOOL64) that caused a duplicate...
Peter Johnson [Mon, 27 Mar 2006 04:55:44 +0000 (04:55 -0000)]
* cv-type.c: Fix typo (CV_T_PFBOOL32 should be CV_T_PFBOOL64) that caused a duplicate definition.

svn path=/trunk/yasm/; revision=1430

18 years ago* coff-objfmt.c (yasm_x64_LTX_objfmt): Enable cv8 debug format for "x64"
Peter Johnson [Mon, 27 Mar 2006 04:29:16 +0000 (04:29 -0000)]
* coff-objfmt.c (yasm_x64_LTX_objfmt): Enable cv8 debug format for "x64"
alias.

svn path=/trunk/yasm/; revision=1429

18 years agoFirst cut at CodeView (version "8" / 2005 only). Completely untested.
Peter Johnson [Mon, 27 Mar 2006 02:15:19 +0000 (02:15 -0000)]
First cut at CodeView (version "8" / 2005 only).  Completely untested.

* md5.c, md5.h: Import MD5 from public domain version in CVS source.
* libyasm/Makefile.inc: Attach to libyasm build.
* libyasm.h: Include md5.h.

* coretype.h (yasm_value): Add new section_rel member.
* value.h (yasm_value_init, yasm_value_init_sym): Initialize.
* value.c (yasm_value_output_basic): Don't output if set.
* xdf-objfmt.c (xdf_objfmt_output_value): Likewise.
* elf-objfmt.c (elf_objfmt_output_value): Likewise.
* coff-objfmt.c (coff_objfmt_output_value): Generate SECREL for this.

* coretype.h (YASM_PATHSEP): New define for path separator.
* vc8/config.h, vc/config.h, dj/config.h: Override.

* dbgfmts/codeview: New, adds "cv8" dbgfmt.
* dbgfmts/Makefile.inc: Hook into build.
* coff-objfmt.c: Enable cv8 dbgfmt for win32 and win64.  Change a few things
to more closely match MASM output.
(coff_section_data): Add isdebug flag so that section flags are set properly.
(coff_objfmt_secton_switch): Initialize to 0 here.
(coff_objfmt_init_remaining_section): Initialize to 1 and set various section
flags (DATA, DISCARD, READ) if section name starts with ".debug".
(coff_objfmt_output): If non-NULL dbgfmt, set object flags to say line numbers
are included.

* dwarfwin64_testhd.hex: Minor update due to coff_objfmt_output() change.

svn path=/trunk/yasm/; revision=1428

18 years ago* x86id.c: Fix pause instruction (closing #72).
Peter Johnson [Wed, 22 Mar 2006 16:49:41 +0000 (16:49 -0000)]
* x86id.c: Fix pause instruction (closing #72).

svn path=/trunk/yasm/; revision=1427

18 years ago* dwarf2-line.c: Avoid obvious crash case on unassigned file number.
Peter Johnson [Wed, 22 Mar 2006 09:21:36 +0000 (09:21 -0000)]
* dwarf2-line.c: Avoid obvious crash case on unassigned file number.

svn path=/trunk/yasm/; revision=1426

18 years ago* libyasm/Makefile.inc: Alphabetize source and include files.
Peter Johnson [Wed, 22 Mar 2006 03:25:02 +0000 (03:25 -0000)]
* libyasm/Makefile.inc: Alphabetize source and include files.

svn path=/trunk/yasm/; revision=1425

18 years ago* coff-objfmt.c (coff_objfmt_output_value): Add support for SEG value as
Peter Johnson [Mon, 20 Mar 2006 06:15:15 +0000 (06:15 -0000)]
* coff-objfmt.c (coff_objfmt_output_value): Add support for SEG value as
COFF has a SECTION relocation that supports this.

* win32-segof.asm: New test for above.

svn path=/trunk/yasm/; revision=1424