Commit graph

227 commits

Author SHA1 Message Date
Peter Johnson
21889fc92d Merge [2317] from trunk.
svn path=/branches/yasm-1.0/; revision=2318
2010-04-08 06:13:03 +00:00
Peter Johnson
e56ece9a7d vsyasm: Allow override of object, list, and map file extensions.
svn path=/trunk/yasm/; revision=2309
2010-03-19 23:00:36 +00:00
Peter Johnson
e55891a302 vsyasm: Fix map extension.
svn path=/trunk/yasm/; revision=2308
2010-03-19 22:46:16 +00:00
Peter Johnson
d7c5571bcb vsyasm: if -E is used, print command line as first line in error file.
Requested by: Brian Gladman

svn path=/trunk/yasm/; revision=2300
2010-03-04 05:13:48 +00:00
Peter Johnson
d28f2a03a7 vsyasm: More gracefully handle single input file by using output name as-is.
Patch by: Brian Gladman

svn path=/trunk/yasm/; revision=2291
2010-02-19 07:07:51 +00:00
Peter Johnson
c699637602 vsyasm: create intermediate output directories if necessary.
This feature is apparently assumed by MSBUILD.

Contributed (with minor modifications) by: Brian Gladman

svn path=/trunk/yasm/; revision=2287
2010-02-13 08:42:27 +00:00
Peter Johnson
463f4d7963 Add "vsyasm", a batch version of yasm primarily useful for VS2010.
Basically the objfile, listfile, and mapfile options specify output
directories instead of files.  Multiple files are accepted and each one
is independently assembled in command line order.  All options (such
as include directories and predefined macros) apply to all input files.
Any error terminates the process early.

Suggested by: Brian Gladman

svn path=/trunk/yasm/; revision=2284
2010-02-06 09:27:32 +00:00
Peter Johnson
b3d84a8148 Implement some linemap changes required for the GAS preprocessor.
Contributed by: Alexei Svitkine <alexei.svitkine@gmail.com>

- yasm_linemap_set() now takes virtual_line as a parameter, instead of
always using linemap->current. If 0 is passed for the virtual_line,
then linemap->current is used, as before.

This is because linemap->current was only incremented by the parser
(and never decremented), so the preprocessor was not able to set
mappings during the preprocessing phase (whereas with these changes,
it now does).

Additionally, setting a mapping for a line number will now delete any
existing mappings for line numbers equal or greater to that line
number. This allows the code to correctly handle the case when the
preprocessor first sets mappings from pre-pp lines to post-pp lines,
and later those mappings getting superseded by .line directives in the
original source.

This change also required making a change to yasm_linemap_lookup() to
set *file_line to 0 when line is 0 (i.e. preventing line 0 - which
means "don't display line number in output" - from getting mapped).

svn path=/trunk/yasm/; revision=2259
2010-01-03 01:58:23 +00:00
Peter Johnson
27e105a07f Fix --preproc-only (and possibly other long options) by avoiding false
matches on shorter long argument names.

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

svn path=/trunk/yasm/; revision=2248
2009-12-26 04:41:21 +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
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
90697b87e7 tasm.c: Don't include unistd.h.
svn path=/trunk/yasm/; revision=2138
2008-10-08 04:58:08 +00:00
Peter Johnson
19b420b63c tasm frontend: Fix handling of options >2 chars long.
Use yasm__strncasecmp instead of manually lowercasing up to two characters.

svn path=/trunk/yasm/; revision=2136
2008-10-07 06:21:06 +00:00
Peter Johnson
0efccb5ad0 tasm frontend: Fix crash with plain /l option.
svn path=/trunk/yasm/; revision=2135
2008-10-07 06:16:57 +00:00
Peter Johnson
d810f45f7c Add CMakeLists.txt for tasm frontend.
svn path=/trunk/yasm/; revision=2132
2008-10-07 05:47:08 +00:00
Peter Johnson
1e77ce6c40 Add core TASM syntax support.
Contributed by: Samuel Thibault <samuel.thibault@ens-lyon.org>

It is built on top of the NASM parser and preproc, with the following
notable extensions for TASM syntax:
 - case insensitive symbols and filenames,
 - support for segment and size of labels, which permits to avoid giving
   them on each memory dereference,
 - support for data reservation (i.e. e.g. "var dd ?"),
 - support for multiples (i.e. e.g. "var dd 1 dup 10"),
 - little endian string integer constants,
 - additional expression operators: shl, shr, and, or, low, high,
 - additional offset keyword,
 - additional fword and df,
 - support for doubled quotes within quotes,
 - support for array-like and structure-like notations: t[eax] and
   [var].field,
 - support for tasm directives: macro, rept, irp, locals, proc, struc,
   segment, assume.

Notes:

 - Almost all extensions are only effective when tasm_compatible_mode is
   set, so we should have very reduced possible breakage.

 - Because the "and" keyword can be an expression operator and an
   instruction name, the data pseudo-instructions explicitly switch the
   lexer state to INSTRUCTION state to fix the ambiguity.

 - In gen_x86_insn.py, several instructions (namely lds and lea) now take
   relaxed memory sizes.  The reason is that in the case of tasm, the size
   of the actual pointed data is passed up to there, and thus any type of
   data should be accepted.

With all of this, loadlin can be compiled by yasm with quite reduced
modifications.

A new TASM-like frontend is also included.

svn path=/trunk/yasm/; revision=2130
2008-10-07 05:38:11 +00:00
Peter Johnson
53b2d01a77 Fix #132: Add --prefix and --suffix (aka --postfix) options.
These allow arbitrary prefixes and/or suffixes to be added to
externally-visible (GLOBAL, EXTERN, or COMMON) symbol names.

svn path=/trunk/yasm/; revision=2109
2008-06-08 09:06:05 +00:00
Peter Johnson
3196e62ef6 Quiet a warning about casting from a data to function pointer.
This is required to get a function pointer from dlsym().

svn path=/trunk/yasm/; revision=2107
2008-05-25 17:02:24 +00:00
Peter Johnson
e4f292ef16 Enable Id keyword expansion.
svn path=/trunk/yasm/; revision=2100
2008-05-23 06:31:52 +00:00
Peter Johnson
92d938f93f Prepend "lib" on plugin name only on Unix.
svn path=/trunk/yasm/; revision=2099
2008-05-23 06:30:38 +00:00
Peter Johnson
b7f2fbc64f Add cmake build infrastructure.
Not default nor even distributed in the .tar.gz, the cmake build allows for
loadable yasm plugins by building libyasm as a shared library.
Example plugins are in the plugins/ directory, and may be loaded into a
cmake-built yasm using the -N command line option (non-cmake builds will
not have this option).

Tested only on Linux so far, but should be relatively painless to port to
Windows thanks to the use of cmake rather than libtool to create shared
libraries.

The only modification to the main source tree is some conditional-compiled
additions to yasm.c.

svn path=/trunk/yasm/; revision=2098
2008-05-22 09:08:03 +00:00
Peter Johnson
cbf0c7befd Split NASM preprocessor standard macro set between various modules.
Standard macro sets are looked up based on parser and preprocessor keyword
from individual modules.

The "standard" NASM parser macros now reside in the NASM parser, so when
the GAS parser is used with the NASM preprocessor, the NASM-specific macros
are no longer defined.

Object-format specific macros are now individually defined by each object
formatm module.  This allows for the object formats to be independent of the
NASM preprocessor module and yields a small optimization benefit as unused
object format macros don't need to be skipped over.

Also add GAS macro equivalents for the Win64 SEH more complex directives [1].

[1] Requested by Brian Gladman <brg@gladman.plus.com>

svn path=/trunk/yasm/; revision=2082
2008-05-09 06:46:02 +00:00
Peter Johnson
ef8479870e Update copyright dates.
svn path=/trunk/yasm/; revision=2059
2008-04-12 01:17:00 +00:00
Peter Johnson
02075ed7ca Fix #123: Be explicit that errors are such by printing "error:" at beginning
of error messages.

svn path=/trunk/yasm/; revision=2019
2007-12-04 06:19:07 +00:00
Peter Johnson
3ecb2331f3 Correctly warn for map file usage if there are *no* object format
directives.

svn path=/trunk/yasm/; revision=2012
2007-11-15 03:57:34 +00:00
Peter Johnson
52affeb01a Add NASM-compatible multi-section binary support to bin object format.
This allows for arbitrary load (LMA) and execution (VMA) addresses.

The following new section attributes are supported:
 - start (LMA start address)
 - follows (follow another section's last LMA)
 - align (LMA alignment)
 - vstart (VMA start address)
 - vfollows (follow another section's last VMA)
 - valign (VMA alignment)
In addition, sections can be designed progbits or nobits.

The following special symbols are generated for program use:
 - section.<sectname>.start (LMA start address)
 - section.<sectname>.vstart (VMA start address)
 - section.<sectname>.length (section length)

The ORG directive adjusts the file offset relative to LMA, so that if
ORG=0x100, a section with LMA=0x100 will be at file offset 0.

VMA addresses are the same as LMA addresses unless otherwise specified.

Full map file support is supported via the [MAP] directive.  The map output
filename can be set either as a parameter to the [MAP] directive or on the
command line with --mapfile=<filename>.  MAP options are BRIEF, SECTIONS,
SEGMENTS, SYMBOLS, and ALL (all of the above).  If no filename is specified
either on the command line or in the source file, the map is output to
standard output.

Full documentation will be added to the Yasm manual in the near future.

This implementation supports several configurations NASM does not, for
instance http://osdir.com/ml/lang.nasm.devel/2004-12/msg00032.html .
It is also fully 64-bit aware.

Fixes: #71, #99.

svn path=/trunk/yasm/; revision=2010
2007-11-14 08:33:32 +00:00
Peter Johnson
bd06f1aace Support use of EQU values within NASM preprocessor.
Note: label values are still not supported, and probably never will be,
as yasm is single-pass parsing, and only reads the source file once.
Someday we may add specific support for relatively common %if-%error
idioms.

svn path=/trunk/yasm/; revision=2008
2007-11-03 04:37:44 +00:00
Peter Johnson
f9824d2cfc Change preprocessor interface from block-oriented to line-oriented.
This will make certain types of parser-preprocessor synchronization
easier for upcoming feature enhancements.

Due to additional complexity in GAS (rept), internally GAS converts
lines back into blocks.

svn path=/trunk/yasm/; revision=2007
2007-11-03 04:27:35 +00:00
Peter Johnson
43240f8955 Finish cleanups made in [1967].
svn path=/trunk/yasm/; revision=1969
2007-09-20 04:23:48 +00:00
Peter Johnson
bb67a2b08d Fix a couple of warnings (non-prototype functions).
svn path=/trunk/yasm/; revision=1967
2007-09-20 03:55:17 +00:00
paulbarker
a956b0e1db Removed FILE* argument from preprocessor create() interface. The preprocessor now opens the input file itself.
svn path=/branches/multiarch/; revision=1923
2007-08-30 21:08:33 +00:00
paulbarker
76d60df7b8 Removed FILE* argument from parser interface. The FILE* given was simply stored and never used.
svn path=/branches/multiarch/; revision=1922
2007-08-30 21:00:38 +00:00
paulbarker
0157febba0 Fixed yasm frontend to call the correct wrappers (yasm_preproc_create and yasm_arch_create) rather than directly calling members of the preproc and arch modules.
svn path=/branches/multiarch/; revision=1918
2007-08-29 14:08:19 +00:00
Peter Johnson
3e1f0390e2 Add command line option aliases for -d (to -D) and -u (to -U) for
compatibility with NASM command line.

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

svn path=/trunk/yasm/; revision=1902
2007-07-29 06:11:47 +00:00
Peter Johnson
0a3b9a8462 Fix default filename buffer overflow.
Note: this is not a security issue.

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

svn path=/trunk/yasm/; revision=1884
2007-06-23 00:19:57 +00:00
Peter Johnson
7a2583bc7f Call yasm_symtab_parser_finalize() from parser so caller doesn't need to
figure out itself if undef should be changed into extern or not.

svn path=/trunk/yasm/; revision=1828
2007-04-23 04:53:01 +00:00
Peter Johnson
469e54fa4a Update all copyright dates.
svn path=/trunk/yasm/; revision=1827
2007-04-22 05:09:49 +00:00
Peter Johnson
00473ca981 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.

svn path=/trunk/yasm/; revision=1825
2007-04-22 03:32:46 +00:00
Peter Johnson
6a3bf650f4 Fix #104 by removing obsolete comment about -m amd64 not setting BITS=64.
svn path=/trunk/yasm/; revision=1822
2007-04-14 19:55:45 +00:00
Peter Johnson
decb27eaa2 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.

svn path=/trunk/yasm/; revision=1819
2007-03-21 04:23:59 +00:00
Peter Johnson
415eee49ea 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.

svn path=/trunk/yasm/; revision=1812
2007-03-05 08:43:00 +00:00
Peter Johnson
cb4bd8caee 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.

Suggested by: pingved@gmail.com

svn path=/trunk/yasm/; revision=1806
2007-03-01 07:03:16 +00:00
Peter Johnson
6c934ab7cf 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.

Suggested by: pingved@gmail.com

svn path=/trunk/yasm/; revision=1804
2007-03-01 06:03:04 +00:00
Peter Johnson
2f2180767d Massive warnings cleanup and cleanup of size_t vs uintptr_t vs unsigned long.
svn path=/trunk/yasm/; revision=1792
2007-02-24 20:19:27 +00:00
Peter Johnson
11caf966d9 Update copyright date to 2007.
Sync list of contributors with wiki/YasmTeam.

svn path=/trunk/yasm/; revision=1760
2007-02-08 05:02:37 +00:00
Peter Johnson
03d66466d5 Actually fully support "gnu" alias for "gas" parser. A number of places
do a check against the parser name.

Reported by: rugxulo@gmail.com

svn path=/trunk/yasm/; revision=1749
2007-01-31 18:29:12 +00:00
Peter Johnson
b76e60fa3c Output warnings if no errors occurred in preproc-only mode.
svn path=/trunk/yasm/; revision=1694
2006-11-20 07:37:17 +00:00
Peter Johnson
b2b38049a4 Fix #91 and a few other minor nits. Reorganize to make for clearer flow.
svn path=/trunk/yasm/; revision=1688
2006-11-18 06:20:06 +00:00
Peter Johnson
9fde4e1657 Allow overriding of strict-ness requirement with command line option
"--force-strict", which switches Yasm back to the old behavior of treating
any sized operand as "strict" (forcing the actual size).

Requested by: Michael Urman <mu@tortall.net>

svn path=/trunk/yasm/; revision=1681
2006-11-07 06:40:05 +00:00
Peter Johnson
c81b221152 Refactor include file handling into libyasm from preprocessors.
svn path=/trunk/yasm/; revision=1669
2006-10-28 21:31:38 +00:00