Peter Johnson [Mon, 25 Jun 2007 01:05:04 +0000 (01:05 -0000)]
Fix buglet in handling of SEG of SEG:OFF. We were deleting the term at
the wrong level. As we weren't changing numterms before either, this
really could have no effect other than not freeing the memory immediately
(it would be freed later).
Peter Johnson [Sat, 2 Jun 2007 05:21:33 +0000 (05:21 -0000)]
Correct CPU definitions for Prescott, Conroe, Penryn, and Nehalem.
All are 64-bit capable and thus should set CPU_Hammer; Prescott
was mistakingly also setting AMD features such as 3DNow.
Two forms are legal ({} are replaceables):
SECTION {segname} {sectname}
SECTION {sectname} segname={segname}
Also,
SECTION {sectname}
where sectname is unrecognized is also legal, defaults segname to __TEXT,
and generates a warning.
Peter Johnson [Sat, 26 May 2007 17:56:36 +0000 (17:56 -0000)]
Clean up directive handling. This standardizes error/warning messages and
makes value/parameters more well-defined and flexible enough to handle
string parameters. Value/parameters would now be better called name/values,
but avoid changing the name for now.
Peter Johnson [Tue, 15 May 2007 07:27:26 +0000 (07:27 -0000)]
Move absolute section handling into NASM parser, removing all traces of it
from libyasm core. Now absolute sections are tracked locally to the parser
and the parser generates EQUs directly for labels in absolute sections.
Peter Johnson [Tue, 15 May 2007 06:25:56 +0000 (06:25 -0000)]
Fix handling of SVM (AMD Pacifica) instructions that take an implicit
rax/eax/ax operand. This operand actually selects the address size, so
make it a memory operand instead of a register operand (GAS follows this
approach as well). Enable SVM instructions in non-64-bit mode as well.
Now the following opcodes work as intended:
invlpga [rax/eax/ax], ecx
skinit [eax]
vmload/vmrun/vmsave [rax/eax/ax]
Peter Johnson [Sun, 13 May 2007 19:55:54 +0000 (19:55 -0000)]
Clean up expect_() in both parsers. In the nasm parser we were passing a
raw string as a printf string which could have resulted in a random memory
access.
Peter Johnson [Fri, 11 May 2007 02:19:36 +0000 (02:19 -0000)]
Fix #107: Float input "1.000000" hit an edge case in the code that caused
the rounding increment at the end of float conversion to wrap the mantissa
from all 1's to 0, resulting in an incorrect result.
Peter Johnson [Wed, 9 May 2007 04:31:19 +0000 (04:31 -0000)]
Fix handling of SSE4 crc opcodes with 64-bit register operands.
Noticed by: arkon@ragestorm.net
Fix bug relating to recognizing crc32 rax, bh as an error: the opersize=64
changing into REX prefix was happening too late to be caught as an error.
Move this logic from tobytes()/len() functions into finalize(), with proper
prefix handling.
Peter Johnson [Sun, 22 Apr 2007 03:32:46 +0000 (03:32 -0000)]
Bite the bullet and convert tabs to spaces. Previously yasm's source has
been using a mix of tabs and 4 spaces to indent; this looks horrible if
tab size is ever not 8. While I debated converting to tab-only indentation
that would have been a far higher impact to the source.
Peter Johnson [Wed, 21 Mar 2007 04:23:59 +0000 (04:23 -0000)]
Massive update of directive handling, including handling of extern, global,
and common declare. The latter no longer passes through objfmt at parse time;
instead the objfmt must handle them at output time (objfmt-specific
extensions are parsed & stored by the parser). Directives are now handled
using a list (with function pointers) rather than a single function entry
point.
Peter Johnson [Mon, 5 Mar 2007 08:43:00 +0000 (08:43 -0000)]
Restructure yasm_object as the central clearing house for yasm_objfmt,
yasm_dbgfmt, and yasm_arch. This eliminates a lot of redundant keeping
track of this information in the individual object and debug formats and
also simplifies a fair amount of code.
I'm still not happy with how arch gets passed around in output code, but
there may not be much of an alternative there.
While I'm here, clean up some unused variables and functions and re-enable
the warning for unused variables in configure.ac.
Peter Johnson [Sun, 4 Mar 2007 09:21:03 +0000 (09:21 -0000)]
Mach-O object format: 0-fill unused portion of section and segment names
in load commands. This caused test miscompares on other platforms and
could conceivably cause yasm to crash by reading beyond proper boundaries
(but this is unlikely). Functionally the output is the same.
Peter Johnson [Fri, 2 Mar 2007 07:09:28 +0000 (07:09 -0000)]
Follow the lead of GAS and change the prefix order to SEG, ADDR, DATA,
LOCKREP. According to mailing list traffic, Intel prefers this order
(apparently for SIMD?) and AMD doesn't care.
Peter Johnson [Thu, 1 Mar 2007 07:03:16 +0000 (07:03 -0000)]
Add option -Wsize-override to turn on warning on multiple operand size
overrides such as: dword dword [5] or dword word [5]. The warnings for
these are disabled by default, as these combinations are intentially
legal for use with macros.
Peter Johnson [Thu, 1 Mar 2007 06:03:04 +0000 (06:03 -0000)]
Add -E and -s command line options. These mimic the NASM behavior of these
options: -E redirects errors to a file, and -s redirects errors to stdout.
The default for errors is still stderr.
Peter Johnson [Tue, 20 Feb 2007 05:18:47 +0000 (05:18 -0000)]
CV8: Don't put any ".name" symbols into the debug symbol table. These
aren't really useful to the user, and caused issues with things like .xdata
and .pdata, which can't be referenced in other sections.
Peter Johnson [Tue, 13 Feb 2007 07:31:11 +0000 (07:31 -0000)]
Update to gettext 0.16.1.
Note that due to an m4 bug, you need at least m4 1.4.5, and autoconf built
with the newer version of m4, to run autoconf on the source now (this does
not apply if you're just running ./configure from a tarball).
Peter Johnson [Mon, 12 Feb 2007 03:48:53 +0000 (03:48 -0000)]
Add support for Win64 structured exception handling (aka .xdata and .pdata).
Requested by: Myria Chan, Brian Gladman, several others
Helped by: Brian Gladman (format documentation pointers)
This commit adds the necessary directives and some higher-level macros to
make it easier to generate the .xdata and .pdata sections needed for
structured exception handling on Win64. The overall construction mirrors
MASM very closely, so it should be possible for near-direct translation of
MASM code to Yasm; see for example objfmts/win64/tests/sce3.masm and
objfmts/win64/tests/sce4.asm. This commit does *not* break generating these
yourself (which you may want to do if you're a compiler).
This commit adds special proc macros so the function layout will look like:
The "raw pseudo operations" (.directives) as described in MSDN
(http://msdn2.microsoft.com/en-us/library/ms235231(VS.80).aspx)
have been exactly mirrored in Yasm, as follows:
[pushreg], [setframe], [allocstack], [savereg], [savexmm128], [pushframe],
[endprolog]
Note the [] are required.
Additionally, the following macros have been implemented that MASM provides
in ksamd64.inc, and as documented in MSDN
(http://msdn2.microsoft.com/en-us/library/ms235217(VS.80).aspx):
push_reg, rex_push_reg, push_eflags, rex_push_eflags, alloc_stack,
save_reg, save_xmm128, push_frame, set_frame, end_prologue
I'll next work on getting all of this documented in the user manual.
Peter Johnson [Mon, 5 Feb 2007 08:11:52 +0000 (08:11 -0000)]
Support forced identifiers ($foo) in directives. This makes yasm match
NASM behavior with regards to e.g. extern $foo.
Unfortunately this makes yasm start not matching NASM behavior with regards
to the RDF module directive. In NASM, module $foo results in a literal $foo
reference; yasm now requires either a double $ (e.g. $$foo) or quotes (e.g.
"$foo"). The special case for section (section $foo --> literal $foo) is
still present, but keeping this for other directives is extremely difficult.
Peter Johnson [Sun, 4 Feb 2007 00:41:42 +0000 (00:41 -0000)]
Fix #98. Fix implemented by merging any reserve multiple into the main
bytecode multiple.
strucsize.asm tests both creation and instantiation of a nested structure.
[1751] and [1752] fix bugs found during the testing of the instantiation
portion of this testcase.
A side effect of this change is that some errors are found in different
phases, and the error messages are slightly different. Split
reserve-error.asm testcase into two parts to still get full coverage.
Peter Johnson [Mon, 29 Jan 2007 03:32:37 +0000 (03:32 -0000)]
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.
Peter Johnson [Sat, 27 Jan 2007 08:42:48 +0000 (08:42 -0000)]
Fix #96 by setting the timestamp in the COFF header. VC2005's incremental linker uses the
timestamp to determine if the object file has been updated, so not setting it makes for
bad behavior (the object file gets updated, but when the executable is linked it uses the
older "internal" version).
To keep tests passing, check an environment variable (YASM_TEST_SUITE); if this exists, the
timestamp is set to 0. Set this environment variable in out_test.sh.
Peter Johnson [Sat, 20 Jan 2007 05:52:32 +0000 (05:52 -0000)]
Fix bug in [1737]. Using a valid environment variable after a non-existent
one would result in the part of the string prior to the non-existent one
getting dropped.