undefined symbols extern if unused rather than causing undef errors.
* symrec.c (yasm_symtab_parser_finalize): Implement.
(symtab_finalize_info): New (more data to pass to
(symtab_parser_finalize_checksym): Update finalize helper.
* yasm.c (main): Update call to yasm_symtab_parser_finalize().
svn path=/trunk/yasm/; revision=1232
(yasm_arch_create): Add parser and error parameters; now the arch is given
the keyword of the parser in use. The error parameter allows the caller to
find out whether it was the machine name or the parser name that was in
error.
(yasm_arch_module): Change create definition to match yasm_arch_create().
(yasm_arch_create_error): New error typedef for yasm_arch_create() errors.
* lc3barch.c (lc3b_create): Update to match new yasm_arch_create().
* x86arch.c (x86_create): Likewise.
* yasm.c (main): Use new yasm_arch_create() and handle the two kinds of
errors it can now generate. Move parser creation up in the sequence so it
happens before the arch is created.
svn path=/trunk/yasm/; revision=1230
the object format default BITS setting. This makes it so [bits 64] is not
necessary to explicitly specify in the source file.
svn path=/trunk/yasm/; revision=1228
shortening to signed 8-bit immediate from a larger immediate size. This
yields much smaller code for many arithmetic instructions.
Noticed by: Brian Gladman <brg@gladman.plus.com>
svn path=/trunk/yasm/; revision=1227
sections. This breaks section numbering between the file section headers
and the section numbering used by symbols to reference sections.
While we're here, don't even try to number sections during parse... this
numbering is getting overwritten anyway.
Fixes#59 (reported by hkmaly@gmail.com).
svn path=/trunk/yasm/; revision=1226
platforms (notably Win64), unsigned long is not big enough to hold a
pointer.
* Makefile.am, configure.ac: Use ax_create_stdint_h to get us uintptr_t.
* ax_create_stdint_h.m4: Implementation of ax_create_stdint_h autoconf
macro from http://ac-archive.sourceforge.net/guidod/ax_create_stdint_h.html
svn path=/trunk/yasm/; revision=1223
works (was broken for >1 byte files).
(yasm_bc_tobytes): Fix handling of bytecodes that are larger than provided
buffer.
Patch by: Stephen Polkowski <stephen@centtech.com>
svn path=/trunk/yasm/; revision=1219
the .pdata section. This is needed for structured exception handling on AMD64.
Yasm in the long run should generate this info itself via the use of objfmt
specific directives.
Noticed By: Andrew Dunstan <a_dunstan@hotmail.com>
svn path=/trunk/yasm/; revision=1215
Initial patch by: Thomas Weidenmueller <thomas@reactsoft.com>
The NASM preprocessor implementation of this is ugly; the preprocessor
really needs a rewrite to clean it up, but there's other higher-priority
items on the TODO list.
svn path=/trunk/yasm/; revision=1211
Initial patch: Stephen Polkowski <stephen@centtech.com>
Added test case and tightened up so that vmread/vmwrite to/from 32-bit reg
is illegal in 64-bit mode.
svn path=/trunk/yasm/; revision=1209
nasm-macros.c is built. Now they build genmacro and generate nasm-macros.c
at build time, as it's no longer contained in the distribution.
svn path=/trunk/yasm/; revision=1205
* x86id.re (yasm_x86__parse_cpu): Add cases for "PRESCOTT", "SSE3", and "PNI".
(yasm_x86__parse_check_id): Add cases for all 13 new instructions.
Update FILD and FISTP so that common fildstp_insn can be used.
(lddqu_insn): New instruction format.
* x86arch.h (CPU_SSE3): New. Renumber others.
* sse3.asm, sse3.hex, sse3.errwarn: New test case for SSE3 instructions.
* x86/tests/Makefile.inc: Include test in build.
svn path=/trunk/yasm/; revision=1204
much easier to see the bad news when necessary. Thanks go to Peter for
updates to the C tests. Kudos to him having us send most of our tests
through a single shell script!
svn path=/trunk/yasm/; revision=1203
global symbols in ELF. Search for STV_HIDDEN for explanations; these
don't seem to appear in the base ELF documentation.
Sample syntax:
global foo:hidden
Inspiration and base patch provided by Oskari Saarenmaa under our BSD
license. This checkin tweaks and extends Oskari's patch and adds tests.
svn path=/trunk/yasm/; revision=1202
undocumented (in NASM) win32 object format "export" directive.
(yasm_win32_LTX_objfmt): Reference above instead of coff_objfmt_directive.
(coff_objfmt_section_switch): Add support for ".drectve" section.
(coff_objfmt_init_new_section): Refactored from coff_objfmt_section_switch.
* preproc.h (yasm_preproc_module): Add define_builtin for defining macros
before standard.mac macros are processed.
(yasm_preproc_builtin_define): Add prototype and macro to call above.
* raw-preproc.c (raw_preproc_define_builtin): Add (empty).
(yasm_raw_LTX_preproc): Use.
* nasm-preproc.c (nasm_preproc_define_builtin): Add wrapper around new
pp_builtin_define.
(yasm_nasm_LTX_preproc): Use.
* nasm-pp.h (pp_builtin_define): Add prototype.
* nasm-pp.c (builtindef): New list of builtin definitions.
(read_line): Iterate through builtindef.
(pp_builtin_define): Add to builtindef.
* standard.mac: Add wrapper around definition of ORG (only for bin objfmt),
add wrappered EXPORT definition.
* yasm.c (apply_preproc_builtins): Define __YASM_OBJFMT__ to selected objfmt.
(main): Call above in correct places.
* export.asm, export.hex, export.errwarn: New test for use of "export" macro
and directive.
svn path=/trunk/yasm/; revision=1199
* yasm-options.c (parse_cmdline): Make unrecognized options warnings instead
of errors.
These two changes make yasm more closely match the nasm command line. The
long-term fix for this will be making a nasm-like frontend.
Requested by: Brian Gladman <brg@gladman.plus.com>
svn path=/trunk/yasm/; revision=1197
expressions by outputting a 0 if the expr does not have an intnum equivalent.
This is not a fix: the real fix will need to be changing how listfmts get the
final data bytes for a bytecode. This "fix" only replaces the garbage with
0's, not the correct value (e.g. for relative jumps).
Found by: Albrecht Kleine <kleine@ak.sax.de>
svn path=/trunk/yasm/; revision=1196
expression processing. A crash is possible if we don't do this.
* nomem64-err.asm, nomem64-err.errwarn: New order forces split of this into:
* nomem64-err2.asm, nomem64-err2.errwarn: move two cases here.
Found by: Ewout Prangsma <ewout@prangsma.net>
svn path=/trunk/yasm/; revision=1194
pages should now be more consistent across systems.
* arch/Makefile.inc: Build yasm_arch.7 at top level, and in dist_man_MANS
instead of man_MANS. Include build rule for building using XMLTO if XMLTO
is available.
* yasm/Makefile.inc: Likewise (for yasm.1).
* Makefile.am: Change man_MANS to dist_man_MANS. Remove general rules for
.xml.1 and .xml.7. Add dist_man_MANS to MAINTAINERCLEANFILES. Remove
man_MANS from BUILT_SOURCES, DISTCLEANFILES, and EXTRA_DIST.
svn path=/trunk/yasm/; revision=1189
object formats without creating duplicate lists of symbols. XDF and COFF
were updated; ELF needs to reorder the symbols on its own, so for now it's
not been updated to use the common implementation.
* hamt.c (HAMTEntry, HAMT, HAMT_destroy)
(HAMT_insert): Change SLIST to STAILQ.
* symrec.c (sym_type): Add SYM_SPECIAL.
(yasm_symtab_define_special): New.
(yasm_symrec_declare): New; includes all functionality from symtab_declare.
(yasm_symtab_declare): Call yasm_symrec_declare now.
(yasm_symrec_is_special): New.
* symrec.h: Add prototypes for above.
* xdf-objfmt.c: Use symrec_data instead of declaring xdf_symtab.
* xdflong.hex, xdfprotect.hex, xdfother.hex: Update due to symbol reordering.
* coff-objfmt.c: Use symrec_data instead of declaring coff_symtab.
* elftimes.hex, elfso.hex, elfabssect.hex: Update due to symbol reordering.
* elfglobext.hex, elf-x86id.hex, elftest.hex, elfso64.hex: Likewise.
* stabs-elf.hex: Likewise.
svn path=/trunk/yasm/; revision=1188
deletes the old bytecode, so it's not safe to use anything from the old
bytecode after this point (such as the prefixes array passed to arch
finalize).
* x86bc.c (yasm_x86__bc_apply_prefixes): Take x86_common as parameter
rather than bytecode; add line parameter instead of referencing bc->line.
* x86arch.h (yasm_x86__bc_apply_prefixes): Likewise.
* x86id.re (x86_finalize_jmpfar, x86_finalize_jmp)
(yasm_x86__finalize_insn): Apply prefixes before bytecode transform.
svn path=/trunk/yasm/; revision=1186
dynamically loaded modules into the now-static libyasm. I now anticipate
that there would be very few users of the dynamic loading features, and it
yielded a lot of instability and build headaches for very little benefit.
The new build should now be much more cross-platform and faster (there was
a lot of overhead in finding and loading modules).
* libtool.m4, ltdl.m4: Delete.
* m4/Makefile.am: Rename to m4/Makefile.inc and remove references to above.
Change to use subdirectory (flat) build rather than recursive build.
* Makefile.am: Include m4/Makefile.inc rather than having it in SUBDIRS.
* libltdl: Delete.
* frontends/yasm/yasm-module.c: Delete.
* basename.c, dirname.c: Delete (no longer needed by yasm-module.c).
* genmodule.c, module.in: Generator and template for new module.c included
in libyasm that replaces the old yasm-module.c (module.in is a modified
rename of yasm-module.c).
* module.h: Modified rename of old yasm-module.h.
* libyasm.h: Include libyasm/module.h.
* libyasm/Makefile.inc: Build generator and include module.c in libyasm.
* yasm.c: Use new libyasm module interface.
* (many) Makefile.inc: Remove libtool libraries, build all modules into
libyasm library.
* configure.ac: Remove libtool/libltdl references.
* Mkfiles/vc/yasm-module.c: Remove. Still need to fix some of the other
Mkfiles/ build files for these changes.
svn path=/trunk/yasm/; revision=1183
before finalizing instructions.
* x86arch.h (yasm_x86__bc_apply_prefixes): Don't take num_segregs and
prefixes parameters.
* x86bc.c (yasm_x86__bc_apply_prefixes): Move segreg code to...
* x86id.re (yasm_x86__finalize_insn): Here (only user of this code).
(x86_finalize_jmp): Don't pass num_segregs and prefixes.
* x86arch.h (x86_common): New; refactored common bytecode parameters.
(x86_opcode): New; refactored opcode parameters.
(x86_insn): Refactor with x86_common and x86_opcode.
(x86_jmp): Likewise.
* x86id.re (x86_finalize_common, x86_finalize_opcode): New.
(yasm_x86__finalize_insn, x86_finalize_jmp): Use and update substruct refs.
* x86bc.c (x86_common_print, x86_opcode_print): New.
(x86_bc_insn_print, x86_bc_jmp_print): Use and update substruct refs.
(x86_common_resolve): New.
(x86_bc_insn_resolve, x86_bc_jmp_resolve): Use and update substruct refs.
(x86_common_tobytes, x86_opcode_tobytes): New.
(x86_bc_insn_tobytes, x86_bc_jmp_tobytes): Use and update substruct refs.
(yasm_x86__bc_apply_prefixes): Utilize refactor to simplify.
* bytecode.c (bc_insn_finalize): Simplify (or at least level) immediates
and memory operands before passing them off to yasm_arch_finalize_insn().
This may result in some minor performance improvement on complex static
expressions.
* x86arch.h (x86_parse_targetmod): Add X86_FAR_SEGOFF; this is only
generated due to a SEG:OFF immediate being detected during finalize.
(x86_jmp_opcode_sel): Remove JMP_FAR; this is now a separate bytecode.
(x86_jmp): Remove far opcode.
(x86_jmpfar): New bytecode for far jumps.
(yasm_x86__bc_transform_jmpfar): New.
* x86bc.c (x86_bc_callback_jmpfar): New.
(yasm_x86__bc_transform_jmpfar, x86_bc_jmpfar_destroy): New.
(x86_bc_jmp_print): Move far jump code to..
(x86_bc_jmpfar_print): Here (new).
(x86_bc_jmp_resolve, x86_bc_jmpfar_resolve): Likewise (latter new).
(x86_bc_jmp_tobytes, x86_bc_jmpfar_tobytes): Likewise (latter new).
* x86id.re (OPAP_JmpFar): Remove (detected immediately now).
(jmp_insn, call_insn): Update.
(x86_finalize_jmpfar): New.
(x86_finalize_jmp): Remove far jump-related code.
(yasm_x86__finalize_insn): Add check for SEG:OFF immediate operand, and
apply X86_FAR_SEGOFF if necessary. Match OPTM_Far against both X86_FAR
and X86_FAR_SEGOFF. Add shortcut to x86_finalize_jmpfar().
svn path=/trunk/yasm/; revision=1182