Commit graph

2221 commits

Author SHA1 Message Date
Peter Johnson
a530673198 gas-preproc.c: Avoid casting away of const.
svn path=/trunk/yasm/; revision=2247
2009-12-26 04:38:27 +00:00
Peter Johnson
7a6e9cb430 Update gas preproc a bit:
- Handle removal of comments during preprocessing
- Fix a bug with evaluation of nested .if/.else statements.

Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com>

svn path=/trunk/yasm/; revision=2246
2009-12-26 04:30:39 +00:00
Peter Johnson
9f471a9ba9 nasm-pp.c: Use vsnprintf if available.
Patch contributed by: Alexei Svitkine <alexei.svitkine@gmail.com>

svn path=/trunk/yasm/; revision=2245
2009-12-26 04:28:40 +00:00
Peter Johnson
b0fb3fd160 Default to gas preproc for gas parser.
svn path=/trunk/yasm/; revision=2244
2009-12-26 04:26:46 +00:00
Peter Johnson
493c5b8861 Add initial gas preprocessor, contributed by Alexei Svitkine.
Support for include directive amongst other major key pieces.
Does not currently support macros.
Fixes #79.

Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com>

svn path=/trunk/yasm/; revision=2243
2009-12-23 06:45:17 +00:00
Peter Johnson
9f91d82b07 Unbreak gen_x86_insn.py on Python 2.4.
Patch by: Alexei Svitkine <alexei.svitkine@gmail.com>

svn path=/trunk/yasm/; revision=2242
2009-12-06 03:37:43 +00:00
Brian Gladman
4db0d17f64 Add files for building YASM with Visual Studio 2010 (beta 2)
svn path=/trunk/yasm/; revision=2241
2009-12-05 16:33:12 +00:00
Brian Gladman
abef3a711d Update gen_x86_insn.py to work in both Python 2 and 3
svn path=/trunk/yasm/; revision=2240
2009-12-05 16:13:05 +00:00
Peter Johnson
c89b661925 Fix #198: Previous commit accidentally broke a great many instructions.
svn path=/trunk/yasm/; revision=2239
2009-12-01 03:33:03 +00:00
Peter Johnson
ad1280030c Fix a bunch of GAS x86 instruction issues.
- Fix #193: ljmp/lcall not implemented; add 2-operand far jump to jmp/call.
- Add loop{,z,e} instruction suffixes
- Fix a bunch of jmp/call minor issues.
- Vastly improve suffix handling in general to make more consistent and make
  a greater variety of no-suffix instructions work in a way that matches GAS.

svn path=/trunk/yasm/; revision=2238
2009-11-30 03:43:10 +00:00
Peter Johnson
32b5671cf0 Fix #191: Incorrect argument order generated for AMD FMA4 opcodes.
svn path=/trunk/yasm/; revision=2237
2009-11-08 17:30:34 +00:00
Peter Johnson
10b0c9214b Fix #190: Incorrect opcode generated for vphaddudq.
svn path=/trunk/yasm/; revision=2236
2009-11-08 17:14:01 +00:00
Peter Johnson
29ad858dad Fix #189: Avoid compiler warning in genperf.
svn path=/trunk/yasm/; revision=2235
2009-11-03 05:15:37 +00:00
Peter Johnson
4e15ef1cc9 Fix #187: Add new variable CFLAGS_FOR_BUILD for CC_FOR_BUILD compiles.
Due to the need to support cross-building, CC_FOR_BUILD is used instead of
CC for tools that will be run as part of the build process.  However, it
is sometimes necessary to add custom CFLAGS for these builds; CFLAGS_FOR_BUILD
supports this cleanly.

svn path=/trunk/yasm/; revision=2234
2009-10-31 21:52:42 +00:00
Peter Johnson
e15ad1b94b Fix #188: Times forward references would result in bad code generation.
svn path=/trunk/yasm/; revision=2233
2009-10-31 21:45:55 +00:00
Peter Johnson
d9e4f1bc19 Fix #78 further: Support C++ style // comments.
svn path=/trunk/yasm/; revision=2232
2009-09-12 02:38:35 +00:00
Brian Gladman
f3f0f20466 Further change to python invocation in genperf
svn path=/trunk/yasm/; revision=2231
2009-08-12 14:51:57 +00:00
Brian Gladman
de776f46ea improve handling of Python batch file for genperf
svn path=/trunk/yasm/; revision=2230
2009-08-12 14:33:52 +00:00
Peter Johnson
7a0082c94d Fix #186: Avoid memory runaway in optimizer TIMES circular reference checking.
Check for duplicates in backtrace used when checking for circular references.
This uses a simple N^2 algorithm (as the number of items in the backtrace is
usually small) but avoids memory runaway due to duplicate item storage.

svn path=/trunk/yasm/; revision=2229
2009-08-06 07:13:11 +00:00
Peter Johnson
47d7fbf513 Fix #185: Add mkinstalldirs to svn repo, as autogen.sh doesn't pull it in.
svn path=/trunk/yasm/; revision=2227
2009-07-31 02:50:19 +00:00
Peter Johnson
b5f0a4008c Fix #184: test -e is not portable (despite being in POSIX); use test -f instead.
svn path=/trunk/yasm/; revision=2226
2009-07-30 02:19:38 +00:00
Peter Johnson
0e0556cc9d Unbreak distcheck.
svn path=/trunk/yasm/; revision=2224
2009-07-25 05:29:47 +00:00
Peter Johnson
dd7c64f68a Fix #178: Don't "distribute" shift right op.
This breaks horribly for things like (sym+511)>>9 in -f bin, as the result is
zero instead of something more useful.

Also don't check RHS for symbols; these will fall out later in the assembly
process if they cannot be simplified.

svn path=/trunk/yasm/; revision=2220
2009-07-24 19:01:35 +00:00
Peter Johnson
c2dce0a354 Update elf special symbols:
- Add tlsdesc and tlscall to both x86 and amd64.
 - Add 64-bit pltoff, gotplt, gotoff to amd64.

svn path=/trunk/yasm/; revision=2210
2009-07-22 05:51:35 +00:00
Peter Johnson
948d59417b Unbreak make check (broken by [2206]).
svn path=/trunk/yasm/; revision=2209
2009-07-22 05:49:54 +00:00
Peter Johnson
fbb1fd248d elf: Add latest x86 relocation types.
svn path=/trunk/yasm/; revision=2208
2009-07-22 05:45:03 +00:00
Peter Johnson
0f373ef2ae elf: Add support for 64-bit PC-relative relocation.
svn path=/trunk/yasm/; revision=2207
2009-07-21 06:49:44 +00:00
Peter Johnson
6f329fb107 Special-case _GLOBAL_OFFSET_TABLE_ in elf32/64 to generate appropriate relocs.
This was particularly noticable in GAS, but there was also a bug in NASM
output (lack of fixup within instruction in elf32).

Also:
- changed ssym lookup from a linear search to using assocdata
- added more relocation types (most not implemented)

Reported by: Mark Charney

svn path=/trunk/yasm/; revision=2206
2009-07-21 06:48:42 +00:00
Peter Johnson
2e2dbcd04f NASM is now licensed under the 2-clause BSD license.
svn path=/trunk/yasm/; revision=2205
2009-07-20 06:04:58 +00:00
Peter Johnson
d69ce714c1 Fix #177: Make check fails on CR/LF systems.
The diff on the hexdump output was not using -w.

svn path=/trunk/yasm/; revision=2204
2009-07-18 02:33:10 +00:00
Peter Johnson
db5f343748 Fix #175: Only sanity check final section size if no user errors occurred.
svn path=/trunk/yasm/; revision=2203
2009-06-12 07:06:16 +00:00
Peter Johnson
a498736454 Fix #173: Debug full paths were being generated incorrectly.
This was because the path returned by yasm__getcwd() did not have a trailing
slash and thus yasm__combpath() stripped off the last path component.

svn path=/trunk/yasm/; revision=2202
2009-06-03 05:49:18 +00:00
Peter Johnson
9752153285 Fix #171: Broken build in ytasm CMakeLists.txt.
Reported by: postmodern.mod3

svn path=/trunk/yasm/; revision=2201
2009-05-12 01:47:59 +00:00
Peter Johnson
f91196bc8a CMakeLists.txt: Set cmake policy to avoid warning.
svn path=/trunk/yasm/; revision=2200
2009-05-12 01:46:42 +00:00
Peter Johnson
93c4d75fb2 Add support for AMD XOP, FMA4, and CVT16 instructions (replacing SSE5).
AMD has obsoleted the SSE5 spec in favor of these instructions.  These
instructions use an AVX-like new opcode structure called XOP instead of
the SSE5 DREX byte.

The AMD FMA4 instructions are a copy of the *old* Intel FMA instructions.
Intel has since updated their spec, and AMD may follow, but for now we've
implemented what AMD's spec contains.

svn path=/trunk/yasm/; revision=2199
2009-05-10 05:24:46 +00:00
Peter Johnson
e3b6f5bc9b Add gencheck.py Python script to make it easier to generate expected results
from long .asm files that generate simple binary output (e.g. for opcode
testing).

svn path=/trunk/yasm/; revision=2198
2009-05-10 05:21:26 +00:00
Peter Johnson
bccb81d575 tasm (tweaked nasm) preproc fixes:
- comments stripped before tokenization caused strings containing ';'
   to generate warnings (unterminated string) and incorrect output.
 - assume directive parsing did not properly handle ';' as end of line

Also add tests for the above.

Reported by: Rugxulo <rugxulo@gmail.com>

svn path=/trunk/yasm/; revision=2197
2009-04-17 03:25:08 +00:00
Peter Johnson
88ffc99804 tasm parser: Support "not" keyword.
Requested by: Rugxulo <rugxulo@gmail.com>

svn path=/trunk/yasm/; revision=2196
2009-04-17 03:22:25 +00:00
Peter Johnson
8bc9e295a5 Default memory size to "s" for no-suffix FP conversions in GAS syntax.
Reported by: Gregory McGarry <g.mcgarry@ieee.org>

svn path=/trunk/yasm/; revision=2192
2009-03-29 23:25:05 +00:00
Peter Johnson
ff21f3e607 Fix referencing of local label from line that defines nonlocal label.
Reported by: Brian Gladman

svn path=/trunk/yasm/; revision=2190
2009-03-25 03:40:59 +00:00
Peter Johnson
6ad55c80ee Update copyright dates.
svn path=/trunk/yasm/; revision=2188
2009-03-24 06:47:38 +00:00
Peter Johnson
338a832c34 Fix #155: Don't crash on missing %endmacro.
We were crashing because we didn't generate this error until the preproc
module was getting cleaned up, which doesn't happen until after linemap
is cleaned up.  Instead detect and output this error when we reach the end
of preprocessed tokens during the parsing stage.

svn path=/trunk/yasm/; revision=2185
2009-03-24 06:33:32 +00:00
Peter Johnson
73276e64a8 Remove vc7 and vc8 build files, as they're no longer being maintained.
There's a Python script (vc98_swap.py) in the Mkfiles/vc9 directory for
those who want to build with vc8.

svn path=/trunk/yasm/; revision=2184
2009-03-24 05:04:15 +00:00
Peter Johnson
bf635274b1 Rename tasm to ytasm in Unix builds.
We aren't compatible enough to call ourselves the "real" one.

svn path=/trunk/yasm/; revision=2183
2009-03-24 04:58:46 +00:00
Peter Johnson
4d2de8713a Update code generated for alignment padding for more recent processors.
Also match GAS behavior by using different NOP sequences for AMD and Intel.
Different "Long" NOP opcode sequences are used based on the below criteria.

Defaults in 32-bit mode:
 - CPU directive not used: backwards compatible (no long NOP opcodes)
 - CPU directive with Intel CPU >= 686: Intel guidelines, using long NOPs
 - CPU directive with AMD CPU >= K6: AMD guidelines, using long NOPs

Defaults in 64-bit mode:
 - CPU directive not used: Intel guidelines, using long NOPs
 - CPU directive with Intel CPU >= 686: Intel guidelines, using long NOPs
 - CPU directive with AMD CPU >= K6: AMD guidelines, using long NOPs

The above defaults may be overridden with these options to the CPU directive:
 - CPU basicnop: backwards compatible (no long NOP opcodes)
 - CPU intelnop: Intel guidelines, using long NOPs
 - CPU amdnop: AMD guidelines, using long NOPs

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

svn path=/trunk/yasm/; revision=2181
2009-03-20 07:36:49 +00:00
Peter Johnson
b22c1896f7 Use arrays instead of strings to store NOP fill.
svn path=/trunk/yasm/; revision=2180
2009-03-20 05:24:16 +00:00
Brian Gladman
1bdcac64ad Add (but don't enable) AMD K10 alignment padding data
svn path=/trunk/yasm/; revision=2179
2009-03-18 19:57:37 +00:00
Brian Gladman
b39e06bc94 Update yasm.rules file for VC++
svn path=/trunk/yasm/; revision=2178
2009-03-06 09:18:56 +00:00
Peter Johnson
ccac72fdb3 Remove renamed tasm.vcproj (as of [2175] it is ytasm.vcproj).
Add to distribution files.

svn path=/trunk/yasm/; revision=2177
2009-03-04 07:41:59 +00:00
Peter Johnson
92f63a58c7 Unbreak snapshots (broken in [2172]).
Noticed by: Mark Charney <mark.charney@intel.com>

svn path=/trunk/yasm/; revision=2176
2009-03-04 07:39:02 +00:00