Commit graph

18 commits

Author SHA1 Message Date
Peter Johnson
4df9f87323 All Pyrex files: Use __cinit__ instead of __new__ in extension classes.
svn path=/trunk/yasm/; revision=2254
2010-01-01 20:52:25 +00:00
Peter Johnson
36cdd57be2 Add support for second parameter (fill value) to .org directive in GAS
parser.

Add testcase for both local labels and .org fill.

Noticed by: Jung Lee <moorang@gmail.com>
Testcase from: Xiaoming Mo <xiaoming.mo@skelix.org>

svn path=/trunk/yasm/; revision=1899
2007-07-20 03:40:59 +00:00
Peter Johnson
0c344700a7 Massive Python/Pyrex wrapper cleanup. We now use Pyxelator to generate
the C function and data structure wrappers for Pyrex.  We now require
Pyrex 0.9.5 to build the Python wrappers, as only >=0.9.5 has working
weakref support.  We actually need 0.9.5.1, but it's not yet released
(0.9.5 has a crash bug in enum wrapping that we trigger).

Pyxelator works a lot better with non-anonymous enums/structs, so libyasm
has been scrubbed for this.

Next step: full Yasm data structure inspection.

svn path=/trunk/yasm/; revision=1745
2007-01-29 03:32:37 +00:00
Peter Johnson
a1f4c99e94 Remove yasm_immval, moving remaining unique information (sign flag) into
yasm_value.

svn path=/trunk/yasm/; revision=1740
2007-01-21 22:01:34 +00:00
Peter Johnson
9ab89fdfe6 Take [1423] to the next logical step by supporting the general case of
(sym in other section)-(sym in this section) rather than just
(sym in other section)-(curpos) (e.g. sym-$).  Unfortunately supporting
this required precbc to be flowed down to the value_finalize functions,
but it's relatively reasonable to do so, as all of the _finalize() routines
have access to precbc.

Reported by: Peter Tanski <peter_tanski@cox.net>

svn path=/trunk/yasm/; revision=1705
2006-12-10 07:05:06 +00:00
Peter Johnson
827930b5a4 Have incbin search include paths (long-missing feature).
svn path=/trunk/yasm/; revision=1673
2006-10-28 22:06:01 +00:00
Peter Johnson
9445734d22 In preparation for further work on optimizing multiple, break multiple apart
from bytecode.len into bytecode.mult_int.  Add new function
yasm_bc_next_offset() to handle the most common use case of bytecode.len,
figuring out the following bytecode's offset.

svn path=/branches/new-optimizer/; revision=1586
2006-06-20 06:23:07 +00:00
Peter Johnson
114cee8b06 Implement first phase of align and org.
svn path=/branches/new-optimizer/; revision=1567
2006-06-11 06:57:03 +00:00
Peter Johnson
ad687bb34a Get rid of origin_prevbc; it's no longer needed due to yasm_value handling
of PC-relative values.

Add new yasm_value_get_intnum(); this is a simplified variant of
yasm_value_output_basic().

svn path=/branches/new-optimizer/; revision=1560
2006-06-10 04:01:12 +00:00
Peter Johnson
a7b6526ea4 Get rid of calc_bc_dist_func, the only times this was used was when
yasm_common_calc_bc_dist was used.  Rename yasm_common_calc_bc_dist to
yasm_calc_bc_dist, call it directly from the expr functions, and change
higher-level callers to boolean flags of whether to calculate bc distance
or not.

svn path=/branches/new-optimizer/; revision=1550
2006-06-07 04:01:33 +00:00
Peter Johnson
fe09480565 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
2006-05-11 07:00:33 +00:00
Peter Johnson
ad54f1bf5c * 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
2006-05-10 04:18:23 +00:00
Michael Urman
c860753386 Add/Use helpers to pass void* as manually type-checked PyCObjects.
svn path=/trunk/yasm/; revision=1528
2006-05-07 18:23:33 +00:00
Michael Urman
486ae1c73a 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
2006-05-07 16:41:16 +00:00
Peter Johnson
4c33af41ec 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
2006-05-04 07:55:32 +00:00
Peter Johnson
949965d5cb * pyrex.m4: Add a little documentation.
* setup.py, yasm.pyx, *.pxi: Add copyright/license.

svn path=/trunk/yasm/; revision=1458
2006-04-04 08:06:39 +00:00
Peter Johnson
2e851878e4 * bytecode.pxi: Fix definition of yasm_dv_create_string().
svn path=/trunk/yasm/; revision=1455
2006-04-04 06:02:18 +00:00
Peter Johnson
5f284d738c 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
2006-04-03 04:32:25 +00:00