]> granicus.if.org Git - yasm/log
yasm
18 years agoChange genmodule to parse through the Makefile (or Makefile.am) looking for YASM_MODULES,
Peter Johnson [Thu, 5 Oct 2006 06:22:25 +0000 (06:22 -0000)]
Change genmodule to parse through the Makefile (or Makefile.am) looking for YASM_MODULES,
rather than simply taking a list of modules on the command line.  This allows significant
improvement of the behavior when used with Visual Studio, as the "old" way of doing this
with Visual Studio build files was to scan through the .c files; this brought up things
that were actually disabled in the build.

Also incorporate a patch by Charles Bailey to make the VC8 build less noisy, and allow use
of Win32 Bison if it's installed.  Instructions updated as well.

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

18 years agore2c-parser.y: Work around a bug in Bison 2.1; Bison 2.1 generates bad code if both
Peter Johnson [Thu, 5 Oct 2006 06:07:59 +0000 (06:07 -0000)]
re2c-parser.y: Work around a bug in Bison 2.1; Bison 2.1 generates bad code if both
YYPARSE_PARAM and __STDC__ are undefined.

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

18 years agogenversion.c: Include ctype.h to get isdigit() definition.
Peter Johnson [Thu, 5 Oct 2006 05:32:29 +0000 (05:32 -0000)]
genversion.c: Include ctype.h to get isdigit() definition.

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

18 years agoFollow-up to #80 and #81: "xchg ax, ax" can use the short 0x90 form as
Peter Johnson [Wed, 4 Oct 2006 04:38:43 +0000 (04:38 -0000)]
Follow-up to #80 and #81: "xchg ax, ax" can use the short 0x90 form as
16-bit operations don't clear the high bits of the 64-bit register, so
this is effectively a NOP as well.

While I'm still looking at this, make "xchg rax, rax" not output a REX
prefix.

I thought about being extra-clever and have "xchg ax, ax" not output an
operand-size prefix, but thought better of it: if the user says "ax"
they're probably going to expect the prefix to be there.  Left in as
a comment for future readers of the code.

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

18 years agoFix #80: xchg ax, ax or xchg eax, eax in 64-bit mode should not use 90h
Peter Johnson [Tue, 3 Oct 2006 16:24:30 +0000 (16:24 -0000)]
Fix #80: xchg ax, ax or xchg eax, eax in 64-bit mode should not use 90h
opcode.

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

18 years agoImprove error message for illegal use of A/B/C/DH with REX instruction.
Peter Johnson [Tue, 3 Oct 2006 05:33:54 +0000 (05:33 -0000)]
Improve error message for illegal use of A/B/C/DH with REX instruction.

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

18 years agoAccept (but ignore) -O and -Onnn command line options, for compatibility
Peter Johnson [Sat, 30 Sep 2006 08:16:39 +0000 (08:16 -0000)]
Accept (but ignore) -O and -Onnn command line options, for compatibility
with NASM.

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

18 years agoFix #77 by performing symrec-symrec -> subst placeholder transformation
Peter Johnson [Sat, 30 Sep 2006 05:13:41 +0000 (05:13 -0000)]
Fix #77 by performing symrec-symrec -> subst placeholder transformation
recursively in yasm_expr__bc_dist_subst(); before this we would only do
one level, which fails on simple structures like the old NASM align approach
of "($$-$) & value" (as the $$-$ is one level down in the expression).

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

18 years ago- Fix much brokenness in absolute value handling, particularly in regards to
Peter Johnson [Fri, 29 Sep 2006 07:18:45 +0000 (07:18 -0000)]
- Fix much brokenness in absolute value handling, particularly in regards to
  PC-relative relocations (jumps and calls).
- Allow SEG:OFF to be used as just an offset portion (like NASM does).
- Labels in absolute sections that are declared global are given the correct
  absolute value in the symbol table.

One difference from NASM:
  label equ 0040h:001eh
  jmp label
in NASM means the same as:
  jmp 001eh  (a near jump)
but yasm will treat this the same as:
  jmp 0040h:001eh  (a far jump)

I'm still not completely happy with this implementation, but it's workable
and fixes all the bugs I've found so far in absolute handling.

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

18 years agoFix #78: Handle C-style comments (/* */) in GAS parser.
Peter Johnson [Wed, 27 Sep 2006 07:02:27 +0000 (07:02 -0000)]
Fix #78: Handle C-style comments (/* */) in GAS parser.

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

18 years agoFix error message for arch/parser mismatch.
Peter Johnson [Wed, 27 Sep 2006 06:58:50 +0000 (06:58 -0000)]
Fix error message for arch/parser mismatch.

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

18 years agoFix duplicate line at the end of list output.
Peter Johnson [Mon, 25 Sep 2006 05:42:09 +0000 (05:42 -0000)]
Fix duplicate line at the end of list output.

Reported by: Danny Reeves <danny_reeves@hotmail.com>

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

18 years agoFix NASM preprocessor outputting %line for every line.
Peter Johnson [Fri, 22 Sep 2006 05:28:12 +0000 (05:28 -0000)]
Fix NASM preprocessor outputting %line for every line.

Noticed by: Dancie Reeves <danny_reeves@hotmail.com>

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

18 years agoAdd SSE4 (aka SSSE3) instructions.
Peter Johnson [Thu, 21 Sep 2006 05:18:20 +0000 (05:18 -0000)]
Add SSE4 (aka SSSE3) instructions.

Patch contributed by: Mathieu Monnier <manao@melix.net>

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

18 years agoMerge Bit::Vector 6.4 into trunk.
Peter Johnson [Tue, 19 Sep 2006 05:14:50 +0000 (05:14 -0000)]
Merge Bit::Vector 6.4 into trunk.

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

18 years agoRemove ancient doc directory.
Peter Johnson [Tue, 19 Sep 2006 04:02:38 +0000 (04:02 -0000)]
Remove ancient doc directory.

Also remove float (gdtoa and softfloat) directory, as no one is asking for
floating point calculation, we've never integrated any of this code, and
it's just taking up space (note it's still available on a branch).

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

18 years agoFix %INCLUDE in last line of mmac/loop expansion.
Peter Johnson [Mon, 18 Sep 2006 05:40:49 +0000 (05:40 -0000)]
Fix %INCLUDE in last line of mmac/loop expansion.

NASM SF Bug #890790.
Patch by: nasm64developer@yahoo.com

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

18 years agoFix memory leaks in %IF*, %ELIF*, and %UNDEF.
Peter Johnson [Mon, 18 Sep 2006 05:22:11 +0000 (05:22 -0000)]
Fix memory leaks in %IF*, %ELIF*, and %UNDEF.

NASM SF Bug #852464.
Patch by: nasm64developer@yahoo.com

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

18 years agonasm-pp.c: Fix handling of nested %macro and nested %rep.
Peter Johnson [Sun, 17 Sep 2006 17:10:17 +0000 (17:10 -0000)]
nasm-pp.c: Fix handling of nested %macro and nested %rep.

Reported (and test) by: Mathieu Monnier <manao@melix.net>
Fix by: nasm64developer@yahoo.com

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

18 years agoActually use $ECHO_C in test shell scripts.
Peter Johnson [Sat, 16 Sep 2006 05:48:10 +0000 (05:48 -0000)]
Actually use $ECHO_C in test shell scripts.

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

18 years agoMake out_test.sh smart about 0-byte errwarn output and don't require a
Peter Johnson [Sat, 16 Sep 2006 05:43:41 +0000 (05:43 -0000)]
Make out_test.sh smart about 0-byte errwarn output and don't require a
golden errwarn file in this case.  This allows us to remove around 150
0-byte .errwarn test files.

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

18 years ago* yapp: Unbitrot. Note to actually build this you need AM_PROG_LEX in
Peter Johnson [Sat, 16 Sep 2006 04:27:37 +0000 (04:27 -0000)]
* yapp: Unbitrot.  Note to actually build this you need AM_PROG_LEX in
configure.ac (and add this subdirectory to preprocs/Makefile.inc).

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

18 years ago* preproc.h: Fix prototype naming of yasm_preproc_define_builtin (as this
Peter Johnson [Sat, 16 Sep 2006 03:20:24 +0000 (03:20 -0000)]
* preproc.h: Fix prototype naming of yasm_preproc_define_builtin (as this
is a macro, effectively mainly a documentation fix).

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

18 years agoResurrect yapp from revision 998.
Peter Johnson [Sat, 16 Sep 2006 02:22:08 +0000 (02:22 -0000)]
Resurrect yapp from revision 998.

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

18 years ago* section.c (yasm_object_optimize): Set active flag to indicate it's already
Peter Johnson [Sat, 16 Sep 2006 01:36:58 +0000 (01:36 -0000)]
* section.c (yasm_object_optimize): Set active flag to indicate it's already
on QB.  We use this flag other places, but forgot to set it here.  This
could cause an infinite loop in (rare) situations.

Reported by: Brian Gladman <brg@gladman.plus.com>
(also committed the code he sent that hits this bug as a testcase)

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

18 years agoMove CPU_64 and CPU_Not64 to bits 30 and 31 to avoid CPU_EM64T bit conflict
Peter Johnson [Sun, 10 Sep 2006 19:50:48 +0000 (19:50 -0000)]
Move CPU_64 and CPU_Not64 to bits 30 and 31 to avoid CPU_EM64T bit conflict
and allow for a few more bits without constantly moving these two.

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

18 years agoFix invalid memory access on macro with multiple of 16 arguments.
Peter Johnson [Sun, 10 Sep 2006 19:44:18 +0000 (19:44 -0000)]
Fix invalid memory access on macro with multiple of 16 arguments.

Patch by: Mathieu Monnier <mathieu.monnier@polytechnique.org>

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

18 years agoAdd USE64 macro as alias for BITS 64, for parity with USE16 and USE32.
Peter Johnson [Sun, 3 Sep 2006 06:30:54 +0000 (06:30 -0000)]
Add USE64 macro as alias for BITS 64, for parity with USE16 and USE32.

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

18 years agoFix #58 and a more basic form of this bug (all EAs that needed non-zero
Peter Johnson [Sat, 12 Aug 2006 18:27:04 +0000 (18:27 -0000)]
Fix #58 and a more basic form of this bug (all EAs that needed non-zero
displacement length and required optimization would end up with 0
displacement length, causing an internal error).

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

18 years ago * bytecode.h: Fix doxygen comments.
Peter Johnson [Sat, 12 Aug 2006 03:00:33 +0000 (03:00 -0000)]
 * bytecode.h: Fix doxygen comments.

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

18 years agoFix a bunch of unused variable warnings and a warning/bug in
Peter Johnson [Sat, 12 Aug 2006 02:37:05 +0000 (02:37 -0000)]
Fix a bunch of unused variable warnings and a warning/bug in
yasm_object_optimize().

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

18 years agoBring Mkfiles up to date with new optimizer and removal of lc3b.
Peter Johnson [Fri, 11 Aug 2006 03:01:33 +0000 (03:01 -0000)]
Bring Mkfiles up to date with new optimizer and removal of lc3b.

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

18 years ago* POTFILES.in: Unbreak dist by removing a nonexistent file.
Peter Johnson [Thu, 10 Aug 2006 04:50:48 +0000 (04:50 -0000)]
* POTFILES.in: Unbreak dist by removing a nonexistent file.
* Makevars: Set MSGID_BUGS_ADDRESS to eliminate a gettext warning.

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

18 years agoInclude test_bytecode.py and test_expr.py in the distribution, as they're
Peter Johnson [Thu, 10 Aug 2006 04:42:09 +0000 (04:42 -0000)]
Include test_bytecode.py and test_expr.py in the distribution, as they're
called out by the python test framework.

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

18 years agoRemove jmpsize_threshold added in new-optimizer; it's not actually used.
Peter Johnson [Thu, 10 Aug 2006 04:13:05 +0000 (04:13 -0000)]
Remove jmpsize_threshold added in new-optimizer; it's not actually used.

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

18 years agoMerge new-optimizer branch back into trunk (from [1596] of new-optimizer).
Peter Johnson [Thu, 10 Aug 2006 04:02:59 +0000 (04:02 -0000)]
Merge new-optimizer branch back into trunk (from [1596] of new-optimizer).

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

18 years agoMerge [1547]-[1593] (inclusive) from trunk.
Peter Johnson [Thu, 10 Aug 2006 02:31:37 +0000 (02:31 -0000)]
Merge [1547]-[1593] (inclusive) from trunk.

svn path=/branches/new-optimizer/; revision=1597

18 years agoRewrite offset-setter (ORG and ALIGN) optimization to run in program order;
Peter Johnson [Tue, 8 Aug 2006 07:35:35 +0000 (07:35 -0000)]
Rewrite offset-setter (ORG and ALIGN) optimization to run in program order;
this speeds things up and makes expansion more predictable.

svn path=/branches/new-optimizer/; revision=1596

18 years agoDon't include unused checker functions if not checking interval tree
Peter Johnson [Tue, 8 Aug 2006 07:30:22 +0000 (07:30 -0000)]
Don't include unused checker functions if not checking interval tree
assumptions (with CHECK_INTERVAL_TREE_ASSUMPTIONS define).

svn path=/branches/new-optimizer/; revision=1595

18 years agoFix (hopefully finally) fsub and fdiv operand reversal for GAS mode.
Peter Johnson [Tue, 18 Jul 2006 05:16:12 +0000 (05:16 -0000)]
Fix (hopefully finally) fsub and fdiv operand reversal for GAS mode.

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

18 years agoCheck for more complex circular references.
Peter Johnson [Sat, 24 Jun 2006 06:56:49 +0000 (06:56 -0000)]
Check for more complex circular references.

svn path=/branches/new-optimizer/; revision=1590

18 years agoSupport optimization of multiple.
Peter Johnson [Wed, 21 Jun 2006 06:25:52 +0000 (06:25 -0000)]
Support optimization of multiple.

svn path=/branches/new-optimizer/; revision=1589

18 years agoUnbreak compat-queue.h on non-BSD systems.
Peter Johnson [Wed, 21 Jun 2006 06:19:07 +0000 (06:19 -0000)]
Unbreak compat-queue.h on non-BSD systems.

svn path=/branches/new-optimizer/; revision=1588

18 years agoUpdate POTFILES for new optimizer; disable lc3b as it's not active yet.
Peter Johnson [Wed, 21 Jun 2006 04:40:09 +0000 (04:40 -0000)]
Update POTFILES for new optimizer; disable lc3b as it's not active yet.

svn path=/branches/new-optimizer/; revision=1587

18 years agoIn preparation for further work on optimizing multiple, break multiple apart
Peter Johnson [Tue, 20 Jun 2006 06:23:07 +0000 (06:23 -0000)]
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

18 years agoStart implementing support for multiples.
Peter Johnson [Mon, 19 Jun 2006 06:18:11 +0000 (06:18 -0000)]
Start implementing support for multiples.

svn path=/branches/new-optimizer/; revision=1585

18 years agoMake imm8 expansion work.
Peter Johnson [Mon, 19 Jun 2006 03:54:20 +0000 (03:54 -0000)]
Make imm8 expansion work.
This was broken because I had precbc and precbc2 purposes swapped in the
optimizer.

svn path=/branches/new-optimizer/; revision=1584

18 years agoSupport align. Made a few other minor cleanups while doing so.
Peter Johnson [Sun, 18 Jun 2006 21:29:26 +0000 (21:29 -0000)]
Support align.  Made a few other minor cleanups while doing so.

svn path=/branches/new-optimizer/; revision=1583

18 years agoThanks to [1581], x86id seems to be correct now, so commit updated golden
Peter Johnson [Thu, 15 Jun 2006 06:47:24 +0000 (06:47 -0000)]
Thanks to [1581], x86id seems to be correct now, so commit updated golden
files.

svn path=/branches/new-optimizer/; revision=1582

18 years agoFix some bugs in step 2. Actually pass len_diff to expand_term and don't
Peter Johnson [Thu, 15 Jun 2006 06:38:30 +0000 (06:38 -0000)]
Fix some bugs in step 2.  Actually pass len_diff to expand_term and don't
expand inactive spans (per the algorithm documentation).

In the interval tree addition, sanity check inputs so high is always higher
than low.

Add a sanity check to x86_bc_jmp_expand() to detect trying to expand an
already-expanded jump.

svn path=/branches/new-optimizer/; revision=1581

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 agoImplement first cut at optimizer step 2. Limitations:
Peter Johnson [Wed, 14 Jun 2006 07:23:49 +0000 (07:23 -0000)]
Implement first cut at optimizer step 2.  Limitations:
- Does not detect cycles, so will infinite loop.
- Does not yet handle secondary expansion of bc offset bytecodes.
However, dwarf64_leb128 now generates essentially identical code to GAS
(except GAS generates relocs for in-file function refs, whereas yasm does not)
x86id tests also now work, but have not been checked yet (so no checkin of
new golden results yet).

svn path=/branches/new-optimizer/; revision=1578

18 years agoBuild up interval tree. Change how SPECIAL_BC_OFFSET is handled for better
Peter Johnson [Tue, 13 Jun 2006 06:37:37 +0000 (06:37 -0000)]
Build up interval tree.  Change how SPECIAL_BC_OFFSET is handled for better
code commonality.  Change optd.spans to a doubly-linked list and delete
directly from it rather than deactivating.

svn path=/branches/new-optimizer/; revision=1577

18 years ago* compat-queue.h: Update; adds FOREACH_*_SAFE, removes circular queues.
Peter Johnson [Tue, 13 Jun 2006 05:09:09 +0000 (05:09 -0000)]
* compat-queue.h: Update; adds FOREACH_*_SAFE, removes circular queues.

svn path=/branches/new-optimizer/; revision=1576

18 years agoMove towards building interval tree by splitting dependent value into
Peter Johnson [Mon, 12 Jun 2006 07:53:49 +0000 (07:53 -0000)]
Move towards building interval tree by splitting dependent value into
sym-sym terms.  Starting to get some code duplication that should get
refactored somehow, but the first priority is getting it working.

svn path=/branches/new-optimizer/; revision=1575

18 years agoyasm_intnum_set_int(): Oops; compile before committing next time.
Peter Johnson [Mon, 12 Jun 2006 05:30:22 +0000 (05:30 -0000)]
yasm_intnum_set_int(): Oops; compile before committing next time.

svn path=/branches/new-optimizer/; revision=1574

18 years agoAdd yasm_intnum_set_int().
Peter Johnson [Mon, 12 Jun 2006 05:29:22 +0000 (05:29 -0000)]
Add yasm_intnum_set_int().

svn path=/branches/new-optimizer/; revision=1573

18 years agoSet svn:keywords on inttree.c and inttree.h.
Peter Johnson [Sun, 11 Jun 2006 22:04:34 +0000 (22:04 -0000)]
Set svn:keywords on inttree.c and inttree.h.

svn path=/branches/new-optimizer/; revision=1572

18 years agoActually bring interval tree implementation into repo.
Peter Johnson [Sun, 11 Jun 2006 22:03:50 +0000 (22:03 -0000)]
Actually bring interval tree implementation into repo.

svn path=/branches/new-optimizer/; revision=1571

18 years agox86_bc_insn_expand(): Don't require ea/imm to be abs to expand, and check
Peter Johnson [Sun, 11 Jun 2006 20:30:46 +0000 (20:30 -0000)]
x86_bc_insn_expand(): Don't require ea/imm to be abs to expand, and check
span ID.
dwarf32_testhd.hex: New optimizer downsizes .text by 4 bytes, update.

svn path=/branches/new-optimizer/; revision=1570

18 years agoRevert value.c/h changes made in [1567].
Peter Johnson [Sun, 11 Jun 2006 20:12:51 +0000 (20:12 -0000)]
Revert value.c/h changes made in [1567].

svn path=/branches/new-optimizer/; revision=1569

18 years agoMove closer to implementing Q.
Peter Johnson [Sun, 11 Jun 2006 08:51:19 +0000 (08:51 -0000)]
Move closer to implementing Q.

svn path=/branches/new-optimizer/; revision=1568

18 years agoImplement first phase of align and org.
Peter Johnson [Sun, 11 Jun 2006 06:57:03 +0000 (06:57 -0000)]
Implement first phase of align and org.

svn path=/branches/new-optimizer/; revision=1567

18 years agoReimplement optimizer pass 1b and fix x86 so that jumps handle one pass of
Peter Johnson [Sat, 10 Jun 2006 20:34:32 +0000 (20:34 -0000)]
Reimplement optimizer pass 1b and fix x86 so that jumps handle one pass of
expansion.

svn path=/branches/new-optimizer/; revision=1566

18 years agox86_bc_insn_tobytes(): Fix the case where we get here with imm8 post-op
Peter Johnson [Sat, 10 Jun 2006 18:35:36 +0000 (18:35 -0000)]
x86_bc_insn_tobytes(): Fix the case where we get here with imm8 post-op
still enabled; we need to fix up the immlen to 8 (as it's maintained with
the wordsize version up to this point).

svn path=/branches/new-optimizer/; revision=1565

18 years agoReintegrate stabs dbgfmt.
Peter Johnson [Sat, 10 Jun 2006 17:24:13 +0000 (17:24 -0000)]
Reintegrate stabs dbgfmt.

svn path=/branches/new-optimizer/; revision=1564

18 years agox86_bc_jmp_calc_len(): Make sure we always set jmp->op_sel.
Peter Johnson [Sat, 10 Jun 2006 17:00:19 +0000 (17:00 -0000)]
x86_bc_jmp_calc_len(): Make sure we always set jmp->op_sel.

svn path=/branches/new-optimizer/; revision=1563

18 years agoyasm_object_optimize(): Fix error/warning handling by using the new method.
Peter Johnson [Sat, 10 Jun 2006 16:54:45 +0000 (16:54 -0000)]
yasm_object_optimize(): Fix error/warning handling by using the new method.
effaddr.asm: Disable now-unsupported construct of [reg*(label2-label)].
x86_bc_insn_calc_len(): Don't destroy NULL intnum.

svn path=/branches/new-optimizer/; revision=1562

18 years agoFix all tests with miscomparing object files. Dramatically clean up some
Peter Johnson [Sat, 10 Jun 2006 08:00:14 +0000 (08:00 -0000)]
Fix all tests with miscomparing object files.  Dramatically clean up some
x86 code (mainly x86_checkea_calc_displen(), and parts of
x86_bc_insn_calc_len()) to use new yasm_value_get_intnum().
Allow NULL to be passed as bc to yasm_value_get_intnum() to prevent
calculation of PC-relative values (returning NULL instead).

svn path=/branches/new-optimizer/; revision=1561

18 years agoGet rid of origin_prevbc; it's no longer needed due to yasm_value handling
Peter Johnson [Sat, 10 Jun 2006 04:01:12 +0000 (04:01 -0000)]
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

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 agoGet rid of calc_bc_dist_func, the only times this was used was when
Peter Johnson [Wed, 7 Jun 2006 04:01:33 +0000 (04:01 -0000)]
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

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 agoChange yasm_value macros into functions. Fix up the prototype of
Peter Johnson [Wed, 31 May 2006 06:25:28 +0000 (06:25 -0000)]
Change yasm_value macros into functions.  Fix up the prototype of
yasm_value_init_sym (which was out of date).

svn path=/branches/new-optimizer/; revision=1546

18 years agoMerge [1333]-[1543] (inclusive) into new-optimizer branch. This results in
Peter Johnson [Wed, 31 May 2006 06:13:01 +0000 (06:13 -0000)]
Merge [1333]-[1543] (inclusive) into new-optimizer branch.  This results in
a temporary regression of functionality but will yield some benefits later
on (chief among them is easier eventual merging back to the mainline!).

svn path=/branches/new-optimizer/; revision=1545

18 years agoChange calc_len to call back to add_span function so that multiple spans can
Peter Johnson [Sun, 28 May 2006 04:54:44 +0000 (04:54 -0000)]
Change calc_len to call back to add_span function so that multiple spans can
be added by a single calc_len.

svn path=/branches/new-optimizer/; revision=1544

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