]> granicus.if.org Git - yasm/log
yasm
19 years ago* yasm.c (main): Make sure we check for undefined symbols before doing any
Peter Johnson [Fri, 21 Jan 2005 23:46:27 +0000 (23:46 -0000)]
* yasm.c (main): Make sure we check for undefined symbols before doing any
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

19 years ago* nasm-token.re (nasm_parser_lex): b/q/h suffixes should be case-insensitive.
Peter Johnson [Wed, 19 Jan 2005 02:51:38 +0000 (02:51 -0000)]
* nasm-token.re (nasm_parser_lex): b/q/h suffixes should be case-insensitive.
* numcase.asm, numcase.errwarn, numcase.hex: Add testcases.

Noticed by: Albrecht Kleine <kleine@ak.sax.de>

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

19 years ago* symrec.c (yasm_symrec_print): Add SYM_SPECIAL to type switch.
Peter Johnson [Fri, 14 Jan 2005 05:27:33 +0000 (05:27 -0000)]
* symrec.c (yasm_symrec_print): Add SYM_SPECIAL to type switch.

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

19 years agoMove pregenerated man pages to root.
Peter Johnson [Fri, 14 Jan 2005 05:25:30 +0000 (05:25 -0000)]
Move pregenerated man pages to root.

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

19 years ago* symrec.h (yasm_symrec_declare): Rename rec parameter to symrec to match
Peter Johnson [Thu, 13 Jan 2005 07:17:06 +0000 (07:17 -0000)]
* symrec.h (yasm_symrec_declare): Rename rec parameter to symrec to match
documentation.

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

19 years agoChange how man pages are built (and where they are built to). Building man
Peter Johnson [Thu, 13 Jan 2005 07:14:48 +0000 (07:14 -0000)]
Change how man pages are built (and where they are built to).  Building man
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

19 years agoAdd some abilities to base symrec so that it can be more effectively used by
Peter Johnson [Wed, 12 Jan 2005 07:53:04 +0000 (07:53 -0000)]
Add some abilities to base symrec so that it can be more effectively used by
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

20 years agoFix up VC, flat, DJ build files to match build changes made in [1183].
Peter Johnson [Tue, 7 Dec 2004 08:05:51 +0000 (08:05 -0000)]
Fix up VC, flat, DJ build files to match build changes made in [1183].

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

20 years agoFix free-before-use case in x86 finalize code. Bytecode transformation
Peter Johnson [Fri, 3 Dec 2004 06:09:30 +0000 (06:09 -0000)]
Fix free-before-use case in x86 finalize code.  Bytecode transformation
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

20 years ago * Makefile.inc: Remove nasm-macros.c from SOURCES; having it there was
Peter Johnson [Thu, 2 Dec 2004 04:05:20 +0000 (04:05 -0000)]
 * Makefile.inc: Remove nasm-macros.c from SOURCES; having it there was
causing it to be built as a standalone file (it's not; it's #included into
one of the other source files).

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

20 years agoSince modules are now built into libyasm, it's no longer necessary to
Peter Johnson [Wed, 1 Dec 2004 08:09:43 +0000 (08:09 -0000)]
Since modules are now built into libyasm, it's no longer necessary to
version them.

 * parser.h, dbgfmt.h, objfmt.h, listfmt.h, optimizer.h, preproc.h, arch.h:
Remove YASM_xxx_VERSION and version module structure member.
 * (many) .c: Don't initialize version module structure member.

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

20 years agoGreatly simplify build system by removing libtool and integrating formerly
Peter Johnson [Wed, 1 Dec 2004 07:49:18 +0000 (07:49 -0000)]
Greatly simplify build system by removing libtool and integrating formerly
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

20 years agoRefactor some the x86 bytecode handling now that we parse the entire file
Peter Johnson [Thu, 18 Nov 2004 06:17:35 +0000 (06:17 -0000)]
Refactor some the x86 bytecode handling now that we parse the entire file
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

20 years ago* bytecode.h: Doxygen cleanups.
Peter Johnson [Tue, 16 Nov 2004 06:41:12 +0000 (06:41 -0000)]
* bytecode.h: Doxygen cleanups.

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

20 years ago* libyasm/tests/Makefile.inc: Build bitvect_test and floatnum_test with
Peter Johnson [Mon, 15 Nov 2004 04:02:24 +0000 (04:02 -0000)]
* libyasm/tests/Makefile.inc: Build bitvect_test and floatnum_test with
standard CFLAGS and LDFLAGS, and as check_PROGRAMS, not noinst_PROGRAMS.

* bitvect_test.c: Update with prototypes to avoid compiler warnings.
* floatnum_test.c: Likewise.

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

20 years agoRemove Check suite; hand-write the two tests that use it. While we're
Peter Johnson [Mon, 15 Nov 2004 00:19:04 +0000 (00:19 -0000)]
Remove Check suite; hand-write the two tests that use it.  While we're
here, remove the bitrotted tests memexpr_test and bytecode_test.

* check: Deleted.
* Makefile.am: Unhook Check suite from build.
* configure.ac: Remove tests for things needed only for Check suite.

* memexpr_test.c: Delete.
* bytecode_test.c: Delete.
* libyasm/tests/Makefile.inc: Delete commented-out references to above.

* bitvect_test.c: Rewrite to not use Check suite.
* floatnum_test.c: Likewise.
* libyasm/tests/Makefile.inc: Don't reference Check suite.

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

20 years agoMove generation of arch instruction bytecodes from on-the-fly during the
Peter Johnson [Sun, 14 Nov 2004 23:17:17 +0000 (23:17 -0000)]
Move generation of arch instruction bytecodes from on-the-fly during the
initial parse stage to a new pass between parse and optimization.  This
should allow for more accurate generation of arch bytecodes and other future
code simplifications in arch.

This change necessitated changing how bytecodes are extended from the base
yasm_bytecode structure; the original method did not allow for bytecodes to
be reliably changed from one type to another, as reallocation of the base
structure to fit the new type could result in the entire structure being
relocated on the heap, and thus all the pointer references to the original
bytecode being lost.  After this commit, the yasm_bytecode base structure
has a void pointer to any extension data.  This change rippled across all
bytecode-creating source files, and comprises the majority of this commit.

* bc-int.h (yasm_bytecode): Add contents pointer.
(yasm_bytecode_callback): Make destroy() and print() take void *contents
instead of bytecode pointer.
(yasm_bc_create_common): Take a pointer to contents instead of datasize.
(yasm_bc_transform): New; transforms a bytecode of any type into a
different type.
* bytecode.c (bytecode_data, bytecode_reserve, bytecode_incbin)
(bytecode_align): Remove bc base structure.
(bc_data_destroy, bc_data_print): Update to match yasm_bytecode_callback.
(bc_reserve_destroy, bc_reserve_print): Likewise.
(bc_incbin_destroy, bc_incbin_print): Likewise.
(bc_align_destroy, bc_align_print): Likewise.
(yasm_bc_create_common): Take a pointer to contents instead of datasize.
(bc_data_resolve, bc_data_tobytes, yasm_bc_create_data): Update to use
contents pointer.
(bc_reserve_resolve, bc_reserve_tobytes, yasm_bc_create_reserve): Likewise.
(bc_incbin_resolve, bc_incbin_tobytes, yasm_bc_create_incbin): Likewise.
(yasm_bc_create_align): Likewise.
(yasm_bc_destroy, yasm_bc_print): Update to match yasm_bytecode_callback.

* section.c (yasm_object_get_general, yasm_object_create_absolute): Pass
a NULL pointer instead of yasm_bytecode size to yasm_bc_create_common().

* stabs-dbgfmt.c (stabs_bc_str, stabs_bc_stab): Remove.
(stabs_bc_str_destroy, stabs_bc_str_print): Update.
(stabs_bc_stab_destroy, stabs_bc_stab_print): Likewise.
(stabs_bc_str_callback, stabs_bc_stab_callback): Add common finalize().
(stabs_dbgfmt_append_bcstr): Update to use contents pointer.
(stabs_dbgfmt_append_stab, stabs_dbgfmt_generate): Likewise.
(stabs_bc_stab_tobytes, stabs_bc_str_tobytes): Likewise.

* lc3barch.h (lc3b_insn): Move here from lc3bbc.c.
(lc3b_new_insn_data, yasm_lc3b__bc_create_insn): Remove.
(yasm_lc3b__bc_transform_insn): New.
* lc3bbc.c (lc3b_insn): Remove (moved).
(lc3b_bc_insn_destroy, lc3b_bc_insn_print): Update.
(lc3b_bc_callback_insn): Add common finalize().
(lc3b_bc_insn_resolve, lc3b_insn_tobytes): Use contents pointer.
(yasm_lc3b__bc_create_insn): Remove.
(yasm_lc3b__bc_transform_insn): New.
* lc3bid.re (yasm_lc3b__parse_insn): Directly create lc3b_insn.

* x86arch.h (x86_insn, x86_jmp): Move here from x86bc.c
(x86_new_insn_data, x86_new_jmp_data): Remove.
(yasm_x86__bc_create_insn, yasm_x86__bc_create_jmp): Remove.
(yasm_x86__bc_transform_insn, yasm_x86__bc_transform_jmp): New.
* x86bc.c (x86_insn, x86_jmp): Remove (moved).
(x86_bc_insn_destroy, x86_bc_insn_print): Update.
(x86_bc_jmp_destroy, x86_bc_jmp_print): Likewise.
(x86_bc_callback_insn, x86_bc_callback_jmp): Add common finalize().
(x86_bc_insn_resolve, x86_insn_tobytes): Use contents pointer.
(x86_bc_jmp_resolve, x86_jmp_tobytes): Likewise.
(yasm_x86__bc_create_insn, yasm_x86__bc_create_jmp): Remove.
(yasm_x86__bc_transform_insn, yasm_x86__bc_transform_jmp): New.
* x86id.re (yasm_x86__parse_insn, x86_parse_jmp): Directly create bytecode
contents.

* bc-int.h (yasm_bytecode_callback): Add new finalize() that will finalize
a bytecode after the parse stage.
(yasm_bc_finalize_common): New; common version of bytecode callback
finalize function.
* bytecode.h (yasm_bc_finalize): New wrapper around callback finalize().
* bytecode.c (yasm_bc_finalize): Implementation.
(yasm_bc_finalize_common): Likewise.
(bc_data_callback, bc_data_reserve_callback, bc_incbin_callback)
(bc_align_callback): Add yasm_bc_finalize_common() as finalize() function.

* section.h (yasm_object_finalize): New; finalizes an entire object.
* section.c (yasm_object_finalize): Implementation.

* yasm.c (main): Call yasm_object_finalize() after parse.

* bc-int.h (yasm_effaddr): Add segreg.
* bytecode.h (yasm_ea_set_segreg): New function to set segreg.
* bytecode.c (yasm_ea_set_segreg): Implement.

* x86bc.c (yasm_x86__ea_create_reg, x86_ea_print, x86_bc_insn_resolve)
(x86_bc_insn_tobytes): Use new EA segreg location.

* coretype.h: Move yasm_insn_operands definition from arch.h to here, as it
is now used in prototypes in bytecode.h.

* bytecode.c (bytecode_insn): New instruction bytecode.
(bc_insn_destroy, bc_insn_print, bc_insn_finalize, bc_insn_resolve)
(bc_insn_tobytes): New callback support functions.
(bc_insn_callback): New.
(yasm_bc_create_insn, yasm_bc_insn_add_prefix, yasm_bc_insn_add_seg_prefix):
New parser-callable functions.
* bytecode.h (yasm_bc_create_insn, yasm_bc_insn_add_prefix)
(yasm_bc_insn_add_seg_prefix): Likewise.

* nasm-bison.y: Call new insn bytecode functions rather than arch functions.

* arch.h (YASM_ARCH_VERSION): Bump version.
(yasm_arch): Rename and extend parse_insn to finalize_insn.  Remove
parse_prefix, parse_seg_prefix, and parse_seg_override.
(yasm_arch_parse_insn): Rename to yasm_arch_finalize_insn.
(yasm_arch_parse_prefix, yasm_arch_parse_seg_prefix)
(yasm_arch_parse_seg_override): Remove.

* lc3barch.c (yasm_lc3b_LTX_arch): Update to match new yasm_arch.
* lc3barch.h (yasm_lc3b__parse_insn): Rename to yasm_lc3b__finalize_insn.
* lc3bid.re (yasm_lc3b__parse_insn): Likewise.

* x86arch.c (x86_parse_prefix, x86_parse_seg_prefix)
(x86_parse_seg_override): Remove.
(yasm_x86_LTX_arch): Update to match new yasm_arch.
* x86arch.h (yasm_x86__parse_insn): Rename to yasm_x86__finalize_insn.
* x86id.re (yasm_x86__parse_insn): Likewise.
(x86_new_jmp): Rename to x86_finalize_jmp.

* x86arch.h (yasm_x86__bc_apply_prefixes, yasm_x86__ea_init): New.
* x86bc.c (yasm_x86__bc_apply_prefixes, yasm_x86__ea_init): Likewise.

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

20 years agoMerged [1173] from 0.4.x branch.
Peter Johnson [Mon, 1 Nov 2004 00:33:46 +0000 (00:33 -0000)]
Merged [1173] from 0.4.x branch.

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

20 years agoRemove mingw build.
Peter Johnson [Mon, 1 Nov 2004 00:30:38 +0000 (00:30 -0000)]
Remove mingw build.

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

20 years ago* linemgr.c (yasm_linemap_create): Initialize pointers in initial
Peter Johnson [Sun, 31 Oct 2004 04:18:37 +0000 (04:18 -0000)]
* linemgr.c (yasm_linemap_create): Initialize pointers in initial
source_info array.  Unless these are initialized to 0,
yasm_linemap_destroy() attempts to free these (invalid) pointers.

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

20 years agoFix #44 by adding support for WRT special symbols (e.g. [sym WRT ..plt] and
Peter Johnson [Sun, 31 Oct 2004 01:07:52 +0000 (01:07 -0000)]
Fix #44 by adding support for WRT special symbols (e.g. [sym WRT ..plt] and
similar) to ELF.  They are used identically to NASM's ELF shared object
support.

Due to limited WRT support throughout libyasm, this caused a lot of rippling
changes.  A major cleanup needs to be performed later to clear some of this
hackiness up.

* elf-machine.h (func_accepts_size_t): Rename to func_accepts_reloc().
(func_map_reloc_info_to_type): Add parameter ssyms for array of special syms.
(elf_machine_ssym): New; for defining machine-specific special syms.
(elf_machine_handler): Change accepts_reloc_size to accepts_reloc.  Add new
ssyms and num_ssyms members.

* elf-x86-x86.c (ssym_index): New; this allows nice indexing of ssym arrays.
(elf_x86_x86_accepts_reloc): Rename of elf_x86_x86_accepts_reloc_size.  Add
support for various WRT ssyms.
(elf_x86_x86_map_reloc_info_to_type): Add support for various WRT ssyms.
(elf_x86_x86_ssyms): New array of supported special symbols.
(elf_machine_handler_x86_x86): Update for above changes/additions.
* elf-x86-amd64.c (ssym_index, elf_x86_amd64_accepts_reloc)
(elf_x86_amd64_map_reloc_info_to_type, elf_x86_amd64_ssyms)
(elf_machine_handler_x86_amd64): Likewise.

* elf.h (elf_reloc_entry): Add wrt member.
(elf_set_arch): Add symtab parameter.
(elf_is_wrt_sym_relative): New.
(elf_reloc_entry_create): Add wrt parameter.
* elf.c (elf_set_arch): Allocate special syms from machine level.
(elf_is_wrt_sym_relative): New; search special syms, and report whether a
WRT ssym should be symbol-relative or section-relative.
(elf_reloc_entry_create): Pass WRT and ssyms info down to machine level.

* elf-objfmt.c (yasm_objfmt_elf): Add dotdotsym (..sym) symrec member.
(elf_objfmt_create): Pass symtab to elf_set_arch().  Allocate ..sym symbol.
(elf_objfmt_output_reloc): Update for elf_reloc_entry_create() change.
(elf_objfmt_output_expr): Handle WRT ssym.  Make relocation symbol-relative
rather than section-relative if either WRT ..sym or WRT ssym that machine
level desires to be symbol-relative.

* symrec.c (yasm_symrec_get_label): Check for NULL sym->value.precbc; this
is now possible due to the user-accessible special symbols that ELF et al
create, which all have NULL precbc's.

* expr.c (yasm_expr_extract_symrec): Recurse into IDENT's to make more exprs
acceptable.

* coretype.h (yasm_output_reloc_func): Remove rel parameter as it shouldn't
be needed and complexifies writing of the reloc functions.
* stabs-dbgfmt.c (stabs_bc_stab_tobytes): Update output_reloc() call.
* elf-objfmt.c (elf_objfmt_output_reloc): Update to match.

* arch.h (yasm_arch_module): Add intnum_fixup_rel() function, change
intnum_tobytes() to not take rel parameter.  The rel functionality is being
separated because sometimes it's desirable not to put the data into the
written intnum (e.g. ELF RELA relocations).
(YASM_ARCH_VERSION): Bump due to above change.
(yasm_arch_intnum_fixup_rel): New wrapper.
(yasm_arch_intnum_tobytes): Update wrapper (removing rel).

* lc3bbc.c (yasm_lc3b__intnum_fixup_rel): New, with code from:
(yasm_lc3b__intnum_tobytes): Remove rel code.
* lc3barch.h (yasm_lc3b__intnum_fixup_rel): New.
(yasm_lc3b__intnum_tobytes): Update.
* lc3barch.c (yasm_lc3b_LTX_arch): Reference yasm_lc3b__intnum_fixup_rel().

* x86bc.c (yasm_x86__intnum_fixup_rel): New, with code from:
(yasm_x86__intnum_tobytes): Remove rel code.
* x86arch.h (yasm_x86__intnum_fixup_rel): New.
(yasm_x86__intnum_tobytes): Update.
* x86arch.c (yasm_x86_LTX_arch): Reference yasm_x86__intnum_fixup_rel().

* xdf-objfmt.c (xdf_objfmt_output_expr): Update to use intnum_fixup_rel() /
new intnum_tobytes().
* bin-objfmt.c (bin_objfmt_output_expr): Likewise.
* coff-objfmt.c (coff_objfmt_output_expr): Likewise.
* elf-objfmt.c (elf_objfmt_output_expr: Likewise.
* nasm-listfmt.c (nasm_listfmt_output_expr): Likewise.

* nasm-bison.y: Change precedence of WRT and : operators: instead of being
the strongest binders they are now the weakest.  This is needed to correctly
parse and be able to split WRT expressions.  WRT handling is still somewhat
of a hack throughout yasm; we'll fix this later.

* x86expr.c (x86_expr_checkea_distcheck_reg): Don't check for WRT here.
(x86_expr_checkea_getregusage): Add new wrt parameter.  Use it to handle
"WRT rip" separately from other operators.  Recurse if there's a WRT below
the WRT rip; this is to handle cases like ELF-AMD64's elfso64.asm.
(yasm_x86__expr_checkea): Split off top-level WRT's and feed through
separately to x86_expr_checkea_getregusage().

* x86bc.c (x86_bc_insn_tobytes): Ensure the SUB operation for PC-relative
displacements goes BELOW any WRT expression.
(x86_bc_jmp_tobytes): Likewise.

* elfso.asm, elfso.hex, elfso.errwarn: New 32-bit ELF shared object tests.
* modules/objfmts/elf/tests/Makefile.inc: Include in distribution.

* elfso64.asm, elfso64.hex, elfso64.errwarn: New 64-bit ELF shared object
tests.  This is not a good example, as the assembled code doesn't work, but
it at least tests the special symbols.
* modules/objfmts/elf/tests/amd64/Makefile.inc: Include in distribution.

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

20 years agoAdd better handling of functions for stabs debugging. It now looks for a
Michael Urman [Sat, 23 Oct 2004 14:56:50 +0000 (14:56 -0000)]
Add better handling of functions for stabs debugging. It now looks for a
potential function as of every bytecode, using the information provided
in revision [1147], and filtering out lables with "." or "$".
  * symrec.c: don't add symrec to bytecode unless added to table.
  * stabs-dbgfmt.c: remove old inefficient code to use new sym lookup.
  * tests/*: create first test, using a copy of elftest.asm.

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

20 years ago* modules.vcproj: Update to include new ELF files.
Peter Johnson [Fri, 15 Oct 2004 17:06:20 +0000 (17:06 -0000)]
* modules.vcproj: Update to include new ELF files.

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

20 years agoMake manual size overrides on effective addresses only work if legal;
Peter Johnson [Thu, 14 Oct 2004 07:46:44 +0000 (07:46 -0000)]
Make manual size overrides on effective addresses only work if legal;
otherwise the override is ignored and a warning is output, so correct
code is always generated.

Reported by: vclaudepierre@tiscali.fr
Bugzilla Bug: 40

* x86expr.c (x86_checkea_calc_displen): Output warnings for noreg case;
reorder such that displacement length calculation is done if the warning
is output.
* x86bc.c (x86_bc_insn_resolve): If length was forced but checkea had to
override it, save it always (to avoid multiple warnings).

* addrop.hex: Match corrected code generation.
* addrop.errwarn: Include new warning message.

* ea-warn.asm, ea-warn.errwarn, ea-warn.hex: Test new functionality more
in depth (code thanks to bug reporter).

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

20 years ago* configure.ac: Add detection for libgen.h.
Peter Johnson [Thu, 14 Oct 2004 05:55:21 +0000 (05:55 -0000)]
* configure.ac: Add detection for libgen.h.
* yasm.c: Conditionally include libgen.h for dirname() definition.
* yasm-module.c: Conditionally include libgen.h for basename() definition.

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

20 years ago* x86id.re (x86_new_jmp): Fix evaluation order dependent call when creating
Peter Johnson [Wed, 13 Oct 2004 03:55:04 +0000 (03:55 -0000)]
* x86id.re (x86_new_jmp): Fix evaluation order dependent call when creating
a FAR target expression.  The create_branch() call could be called before
the expr_copy() call; the former can (and does) delete op->data.val.  Move
the expr_copy() call to an earlier statement to force the correct
evaluation order.

Thanks to: HP TestDrive for providing the Itanium system that discovered
this bug.

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

20 years ago* elf-x86-amd64.c: Set svn:keywords "Id".
Peter Johnson [Mon, 11 Oct 2004 04:34:09 +0000 (04:34 -0000)]
* elf-x86-amd64.c: Set svn:keywords "Id".
* elf-x86-x86.c: Likewise.

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

20 years ago* elf.h: Update x86 and amd64 relocation types and associated comments.
Peter Johnson [Mon, 11 Oct 2004 04:30:08 +0000 (04:30 -0000)]
* elf.h: Update x86 and amd64 relocation types and associated comments.
* elf-x86-x86.c: Add 8-bit and 16-bit relocations (GNU extensions).

* tests/Makefile.inc: Rename elfreloc-err to elfreloc-ext, because relocs
tested in elfreloc-err are now legal due to above changes.
* elfreloc-ext.asm: Likewise.
* elfreloc-ext.errwarn: Likewise.
* elfreloc-ext.hex: New output file.

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

20 years agoEnable machine specific handling of relocation section type, since amd64
Michael Urman [Mon, 11 Oct 2004 03:47:28 +0000 (03:47 -0000)]
Enable machine specific handling of relocation section type, since amd64
should use .rela.* instead of .rel.* sections, of type SHT_RELA instead
of SHT_REL.

* elf.h, elf.c: update calls to backend, passing relocations further in.
* elf-machine.h, elf-x86-amd64.c, elf-x86-x86.c: add support for setting
  relocation section name, type, and update amd64 to write RELA records.
  Also when creating a relocation and writing a value to the file, have
  it handled here to keep REL vs RELA distinctions hidden from elf.c.
* elf-rip.hex: update output to match new section type and data output.

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

20 years agoDeconst yasm_expr_get_intnum's return, allowing inplace modifications to
Michael Urman [Mon, 11 Oct 2004 03:42:08 +0000 (03:42 -0000)]
Deconst yasm_expr_get_intnum's return, allowing inplace modifications to
be made. The specific instigator for this is the ability to modify the
value in a relocation stored in a .rela.section so that listings are
"correct".

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

20 years ago* intnum.c (yasm_intnum_zero): New function to zero an existing intnum.
Peter Johnson [Mon, 11 Oct 2004 02:14:34 +0000 (02:14 -0000)]
* intnum.c (yasm_intnum_zero): New function to zero an existing intnum.
* intnum.h (yasm_intnum_zero): Add prototype for above.

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

20 years agoAdd work around for static-build libtool binaries to find preloaded modules
Peter Johnson [Mon, 11 Oct 2004 00:23:10 +0000 (00:23 -0000)]
Add work around for static-build libtool binaries to find preloaded modules
without the presence of the associated ".la" file.  This caused the Win32
nightly snapshots to be unusable (as they're static-built libtool).

At present, a search for a preloaded module occurs first, before the ".la"
is even looked for.

Noticed by: Oliver <mybox@ollysoft.de>

* libtool.m4: Define new config.h variable LIBTOOL_LIBEXT that is the
extension used for static libraries (e.g. ".a").  This is the extension used
for preloaded symbols.

* ltdl.c (lt_dlopenext): Add first search function to find filename.a prior
to other searches (.la and .so), so preloaded symbols are hit first.

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

20 years agoPhase 2 of 2 cleanup to elf's internal structure.
Michael Urman [Sun, 10 Oct 2004 19:25:23 +0000 (19:25 -0000)]
Phase 2 of 2 cleanup to elf's internal structure.

Move and rename functions for cleanliness.

New files:
elf-machine.h - machine-specific interface, and helper macros
elf-x86-x86   - support specific standard ia32
elf-x86-amd64 - support specific to amd64

Modified files:
elf.c         - update the machine structure traversal for external structures
Makefile.inc  - support the new files

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

20 years agoPhase 1 of a 2 phase cleanup to elf's internal structure.
Michael Urman [Sun, 10 Oct 2004 18:40:31 +0000 (18:40 -0000)]
Phase 1 of a 2 phase cleanup to elf's internal structure.

Historically elf.c had a lot of switches for which machines it supports.
This replaces it with a structure of information and function pointers
which is selected in much the same way the switch value was before. Then
all such switches are replaced with calls through the current machine
handler structure.

Phase 2 will relocate each machine's support to its own file.

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

20 years agoAdd relocation information to nasm list format by establishing a common
Peter Johnson [Fri, 8 Oct 2004 07:22:10 +0000 (07:22 -0000)]
Add relocation information to nasm list format by establishing a common
base structure for relocations and using it in all object formats.

* section.h (yasm_reloc): New base relocation type.
* section.c (yasm_section_add_reloc): New function to add a yasm_reloc to a
section.
(yasm_section_relocs_first, yasm_section_reloc_next): New functions to
access yasm_reloc list.
(yasm_reloc_get): New function to get base info from yasm_reloc.
* section.h: New prototypes for above section.c functions.

* section.c (yasm_section): Add relocs and destroy_reloc members.
(yasm_object_get_general): Initialize relocs and destroy_reloc.
(yasm_object_create_absolute): Likewise.
(yasm_section_destroy): Destroy any created relocs.

* xdf-objfmt.c (xdf_reloc): Base off of new yasm_reloc structure.
(xdf_objfmt_output_expr): Update after xdf_reloc changes.
(xdf_objfmt_output_section): Likewise.
(xdf_section_data_destroy): Likewise.
(xdf_section_data_print): Likewise.

* elf.h (elf_secthead): Remove unneeded list of relocs.
(elf_reloc_entry): Base off of new yasm_reloc structure.
* elf.c (elf_reloc_entry_destroy, elf_relocs_create)
(elf_reloc_destroy): Remove.
(elf_reloc_entry_create): Update after elf_reloc_entry changes.
(elf_secthead_append_reloc, elf_secthead_write_relocs_to_file): Take
additional pointer to yasm_section to access new relocations storage and
update for new elf_reloc_entry structure.
(elf_secthead_create): Update after elf_secthead changes.
(elf_secthead_destroy): Likewise.
(elf_secthead_print): Likewise.
* elf-objfmt.c (elf_objfmt_output_reloc, elf_objfmt_output_expr)
(elf_objfmt_output_section, elf_objfmt_output_secthead): Likewise.
* elf.h: Update prototypes for above elf.c changes.

* coff-objfmt.c (coff_reloc): Base off of new yasm_reloc structure.
(coff_objfmt_output_expr): Update after coff_reloc changes.
(coff_objfmt_output_section): Likewise.
(coff_section_data_destroy): Likewise.
(coff_section_data_print): Likewise.

* nasm-listfmt.c (sectreloc, bcreloc): New.
(nasm_listfmt_output_info): Add bcrelocs, next_reloc, next_reloc_addr.
(nasm_listfmt_output_expr): Record relocations in bcrelocs if next_reloc
and next_reloc_addr match the current expr parameters.
(nasm_listfmt_output): Initialize new members of nasm_listfmt_output_info,
and use bcrelocs data generated by nasm_listfmt_output_expr to add reloc
information to list output.

* x86bc.c (x86_bc_jmp_tobytes): Duplicate jmp_target before splitting
SEGOFF (:) pairs.  This avoids a memory leak and doesn't destroy the
ability for the bytecode to be converted to bytes again (which is what
happens when listfmt is used).

* yasm.xml, yasm.1: Add documentation for new listfmt-related options
for yasm frontend: -L (--lformat) and -l (--list).

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

20 years agoUpdate VC++ build files for tree changes.
Peter Johnson [Sat, 2 Oct 2004 20:03:46 +0000 (20:03 -0000)]
Update VC++ build files for tree changes.

* modules.vcproj: Add xdf object format and nasm listfmt.
* yasm-module.c: Likewise.

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

20 years agoFirst part of list file support. This should accurately output all file
Peter Johnson [Sat, 2 Oct 2004 06:18:30 +0000 (06:18 -0000)]
First part of list file support.  This should accurately output all file
bytes and offsets, but relocations are not yet indicated.  Also, this
outputs post-preprocessed source, so no comments, etc, are visible in the
list file.

* listfmt.h: New header file describing listfmt module interface.
* coretype.h: Declare new yasm_listfmt typedef.
* libyasm.h: Include listfmt.h.
* libyasm/Makefile.inc (modinclude_HEADERS): Add listfmt.h.

* yasm-module.h (module_type): Add MODULE_LISTFMT for listfmts.
(load_listfmt_module, list_listfmts): New macros for listfmts.
* yasm-module.c (module_type_str): Add listfmt string for MODULE_LISTFMT.
(list_module_load): Add support for MODULE_LISTFMT.

* bytecode.h (yasm_bc_tobytes): Comment clarification on effect of calling
yasm_bc_tobytes twice on the same bytecode.

* linemgr.h: Replace support for associated data with support for bytecode
and source line information.
(yasm_linemap_get_data): Remove.
(yasm_linemap_get_source): Add.
(yasm_linemap_add_data): Remove.
(yasm_linemap_add_source): Add.
* linemgr.c (yasm_linemap, yasm_linemap_create, yasm_linemap_destroy)
(yasm_linemap_add_data, yasm_linemap_add_source, yasm_linemap_get_data)
(yasm_linemap_get_source): Likewise.

* nasm-token.re (fill): Save previous 2 lines instead of previous 1 line.
(destroy_line, print_line, line_assoc_data): Remove.
(save_line): Save line in structure instead of calling yasm_linemap_add_data.
* nasm-bison.y (input rule): Call yasm_linemap_add_source here.
* nasm-parser.h (yasm_parser_nasm): Add second line of storage and save_last
variable to toggle between the two lines.
* nasm-parser.c (nasm_parser_do_parse): Initialize save_last.

* modules/Makefile.inc: Include new modules/listfmts/Makefile.inc.
* modules/listfmts/Makefile.inc: New;
includes modules/listfmts/nasm/Makefile.inc.
* modules/listfmts/nasm/Makefile.inc: New build file for NASM-like listfmt.
* nasm-listfmt.c: New NASM-like listfmt.

* yasm.c: Enable use of listfmts, and default to NASM listfmt.
(list_filename, cur_listfmt, cur_listfmt_module): New listfmt variables.
(opt_listfmt_handler, opt_listfile_handler): New listfmt functions.
(options): Add --lformat (-L) and --list (-l) options.
(main): Load "nasm" listfmt as default if none selected.
Enable saving of input lines if list output file enabled.
Open and write to the list file.
(open_obj): Rename to open_file and make more generic.
(cleanup): Destroy listfmt and list filename if created.

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

20 years ago* xdf-objfmt.c (xdf_reloc.type): Remove FLAT relocation type and renumber.
Peter Johnson [Wed, 29 Sep 2004 03:36:52 +0000 (03:36 -0000)]
* xdf-objfmt.c (xdf_reloc.type): Remove FLAT relocation type and renumber.
(xdf_objfmt_output_expr): Likewise.
(xdf_section_data_print): Likewise.
* xdf.h (xdf_rtype): Likewise.
* xdfdump.c (print_reloc): Likewise.

* xdf.h: Bump revision number of xdf due to FLAT relocation removal.

* modules/objfmts/xdf/Makefile.inc: Add tests for XDF format.
* modules/objfmts/xdf/tests/Makefile.inc: Likewise.
* xdf_test.sh: Likewise.
* xdflong.asm, xdflong.errwarn, xdflong.hex: Likewise.
* xdfprotect.asm, xdfprotect.errwarn, xdfprotect.hex: Likewise.
* xdfother.asm, xdfother.errwarn, xdfother.hex: Likewise.

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

20 years ago* expr.h (yasm_expr_extract_seg): Comment change: remove documentation for
Peter Johnson [Mon, 27 Sep 2004 05:34:40 +0000 (05:34 -0000)]
* expr.h (yasm_expr_extract_seg): Comment change: remove documentation for
nonexistent "simplify" argument.

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

20 years ago* expr.c (yasm_expr_extract_symrec): Add "relocate" parameter. Use it to
Peter Johnson [Mon, 27 Sep 2004 04:15:12 +0000 (04:15 -0000)]
* expr.c (yasm_expr_extract_symrec): Add "relocate" parameter.  Use it to
control whether the symbol is replaced with the symbol's value (old
behavior), or just replace it with 0 (new optional behavior).  The old
behavior is enabled by setting relocate=1.
* expr.h (yasm_expr_extract_symrec): Likewise (and document new behavior).
* elf-objfmt.c (elf_objfmt_output_expr): Use new function (with relocate=1).
* coff-objfmt.c (coff_objfmt_output_expr): Likewise.

* expr.c (yasm_expr_extract_segment): Renamed to yasm_expr_extract_segoff, a
more approprate name given what operator it looks at.
* expr.h (yasm_expr_extract_segment): Likewise.
* x86bc.c (x86_bc_jmp_tobytes): Use new function name.

* expr.c (yasm_expr_extract_seg): New function to remove SEG unary operator.
* expr.h (yasm_expr_extract_seg): Likewise.

* expr.c (yasm_expr_extract_shr): New function to split SHR operator into
left and right halves.
* expr.h (yasm_expr_extract_shr): Likewise.

* xdf.h: New header file describing the newly added Extended Dynamic Object
Format (XDF).  Note: GCC-only code.
* xdfdump.c: New utility that uses the format described in xdf.h to
completely dump an XDF file.  Note: non-portable code (runs correctly on
little endian machines only).
Neither of these files are currently included in the distribution.

* xdf-objfmt.c: New YASM objfmt module to output XDF format object files.
* modules/objfmts/xdf/Makefile.inc: Add to build.
* modules/objfmts/Makefile.inc: Likewise.

The XDF object format is a blend between COFF and OMF.  It is a very simple
object format intended for use by operating system loaders or similar types
of targets.  It allows shifted relocations (useful for static interrupt or
page tables), both flat and segment-relative, and the use of the SEG, WRT,
and x86 JMP FAR notations.

Test cases will be committed soon.

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

20 years ago* util.h (BitCount): Change bit-counting algorithm; the old one miscounted
Peter Johnson [Sat, 25 Sep 2004 06:38:57 +0000 (06:38 -0000)]
* util.h (BitCount): Change bit-counting algorithm; the old one miscounted
4096 (0x1000) as having 257 bits; almost certainly other values were broken
as well.

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

20 years ago* bc-int.h (yasm_bytecode): Add new pointer to array symrecs. This is a
Peter Johnson [Mon, 13 Sep 2004 02:44:00 +0000 (02:44 -0000)]
* bc-int.h (yasm_bytecode): Add new pointer to array symrecs.  This is a
NULL-terminated array of labels that point to this bytecode (as the bytecode
previous to the label).  NULL if no labels point to this bytecode.

* bytecode.c (yasm_bc_create_common): Initialize symrecs variable to NULL.
* bytecode.c (yasm_bc_destroy): Delete symrecs variable.

* bytecode.h (yasm_bc__add_symrec): Declare new function.
* bytecode.c (yasm_bc__add_symrec): New.

* symrec.c (yasm_symtab_define_label): Call yasm_bc__add_symrec().

This new functionality is needed to make writing certain dbgfmt routines
easier.

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

20 years agoAdd a final SO for any .text section. This is used to identify the end
Michael Urman [Mon, 13 Sep 2004 00:01:03 +0000 (00:01 -0000)]
Add a final SO for any .text section. This is used to identify the end
of the final function.

FIXME: This creates a symbol (label .n_so) which currently has to be
added to the symtab. Peter thinks it should work fine outside the table,
so perhaps this is a bug in elf. Currently without being in the table
instead of identifying the end of the function, it identifies offset 0.

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

20 years ago* yasm_arch.xml, yasm_arch.7: Fix typo in 64-bit implicit zero extension
Peter Johnson [Sun, 12 Sep 2004 21:06:45 +0000 (21:06 -0000)]
* yasm_arch.xml, yasm_arch.7: Fix typo in 64-bit implicit zero extension
example code.

Noticed by: mu@

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

20 years ago* ins.h, scanner.h, dfa.h, code.c, re.h, parse.h, token.h, substr.h:
Peter Johnson [Sun, 12 Sep 2004 07:57:47 +0000 (07:57 -0000)]
* ins.h, scanner.h, dfa.h, code.c, re.h, parse.h, token.h, substr.h:
Remove use of "inline".  This could cause breakage on non-gcc systems (as
these files do not use config.h because of cross-build reasons).

* yasm.dep, yasm.mak, yasm.dsp, yasm.dsw: Remove support for VC6 builds.
* libyasm.dsp, libyasm.mak, libyasm.dep: Likewise.
* modules.dsp, modules.mak, modules.dep: Likewise.

* yasm.suo: Remove unneeded user options file.

* vc: Update svn:ignore property to reflect removal of VC6 builds and user
options file.

* genmacro.vcproj: Generate genmacro tool.
* genmacro/run.bat: Use genmacro to generate nasm-macros.c.
* modules.vcproj: Point to the new location for nasm-macros.c.

* re2c.vcproj: Generate re2c tool.
* re2c/run.bat: Use re2c to generate re2c-generated .c files.

* yasm.sln: Utilize genmacro and re2c.

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

20 years ago* tools/re2c/Makefile.inc: Update build rules for re2c-parser.c and
Peter Johnson [Sun, 12 Sep 2004 06:21:09 +0000 (06:21 -0000)]
* tools/re2c/Makefile.inc: Update build rules for re2c-parser.c and
re2c-parser.h, and include the generated files in the distribution.

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

20 years ago* yasm_arch.xml, yasm_arch.1: Add large section on 64 bit mode.
Peter Johnson [Sat, 11 Sep 2004 07:20:49 +0000 (07:20 -0000)]
* yasm_arch.xml, yasm_arch.1: Add large section on 64 bit mode.

* yasm_arch.xml, yasm_arch.1, yasm.xml, yasm.1: Convert tabs to spaces.

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

20 years ago* yasm_arch.xml, yasm.xml: Turn on Id keyword expansion
Peter Johnson [Fri, 10 Sep 2004 23:15:15 +0000 (23:15 -0000)]
* yasm_arch.xml, yasm.xml: Turn on Id keyword expansion

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

20 years ago* arch/lc3b/README, arch/x86/README: Remove (replaced by man page).
Peter Johnson [Fri, 10 Sep 2004 22:58:04 +0000 (22:58 -0000)]
* arch/lc3b/README, arch/x86/README: Remove (replaced by man page).

* yasm_arch.xml, yasm_arch.7: Add new man page describing architectures.

* yasm.xml, yasm.1: Reference yasm_arch(7).

* Makefile.am: Add build rules for .7 man pages.

* modules/arch/Makefile.inc: Build yasm_arch.7.

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

20 years ago* Makefile.am: Unbreak build (broken due to new man page generation).
Peter Johnson [Tue, 7 Sep 2004 16:16:01 +0000 (16:16 -0000)]
* Makefile.am: Unbreak build (broken due to new man page generation).

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

20 years ago* configure.ac: Remove check for groff, add check for xmlto.
Peter Johnson [Tue, 7 Sep 2004 07:39:26 +0000 (07:39 -0000)]
* configure.ac: Remove check for groff, add check for xmlto.
* Makefile: Add support for building man pages from DocBook XML refentry's
using xmlto.

* frontends/yasm/yasm.xml: New.  Source XML file for yasm(1) man page.
* frontends/yasm/yasm.1: Generated yasm(1) man page.  We may want to remove
this at some point, but it would have impact on those keeping up with HEAD.

* frontends/yasm/Makefile.inc: Add new yasm(1) man page to distribution and
install.

* HACKING: Update required tools list.  Rename "CVS" to "Subversion".
Remove "Generating ChangeLogs" section, as with Subversion this is not
necessary.

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

20 years ago* On most files: re-enable $IdPath$ as $Id$, and enable Id keyword expansion.
Peter Johnson [Sat, 4 Sep 2004 01:24:57 +0000 (01:24 -0000)]
* On most files: re-enable $IdPath$ as $Id$, and enable Id keyword expansion.

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

20 years ago* errwarn.h (yasm_warn_class): Add new class YASM_WARN_ORPHAN_LABEL.
Peter Johnson [Sat, 4 Sep 2004 00:25:20 +0000 (00:25 -0000)]
* errwarn.h (yasm_warn_class): Add new class YASM_WARN_ORPHAN_LABEL.
* errwarn.c (yasm_errwarn_initialize): Disable YASM_WARN_ORPHAN_LABEL by
default.

* nasm-bison.y (lineexp): Warn (controlled by YASM_WARN_ORPHAN_LABEL) on
labels alone on a line without a colon.

* yasm.c (opt_warning_handler): Add option "-Worphan-labels" (and
"-Wno-orphan-labels" to enable/disable YASM_WARN_ORPHAN_LABEL.

* nasm/tests/worphan/*: Test YASM_WARN_ORPHAN_LABEL warning.
* nasm/tests/orphannowarn.*: Likewise (for disabled case).
* nasm/tests/Makefile.inc: Include worphan tests.

Bugzilla Bug 35
Reported By: vclaudepierre@tiscali.fr

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

20 years ago* x86id.re (yasm_x86__parse_insn): Add checking of effective address size.
Peter Johnson [Fri, 3 Sep 2004 23:01:51 +0000 (23:01 -0000)]
* x86id.re (yasm_x86__parse_insn): Add checking of effective address size.

* x86arch.h (x86_new_insn_data): Add shortmov_op for shortmov post-action.
* x86bc.c (x86_insn): Likewise.
(yasm_x86__bc_create_insn): Copy shortmov_op to instruction.
(x86_bc_insn_resolve): Handle shortmov_op post-action.
* x86id.re (yasm_x86__parse_insn): Set shortmov_op post-action if desired.

* x86id.re (mov_insn): Through reorder and use of new shortmov_op
post-action, change generated code for mov on AMD64.  On AMD64, the short
mov (opcode A0/A1/A2/A3), generated when moving to AL/AX/EAX/RAX from an
absolute address (no registers) has a 64-bit size in 64-bit mode.  While an
address override can reduce it to 32-bits, automatically generating such an
override does not fit well with the model of not doing anything behind the
programmer's back.  Instead, we now generate the 32-bit address size MOD/RM
form unless the address size is specifically set to 64 bits using [qword 0]
notation (this is the equivalent of the GNU AS movabs pseudo-instruction).
The short mov is still generated in 32-bit mode, whether obtained via BITS
setting or an a32 prefix in BITS 64 mode.  (The a32 prefix handling
necessitated the new shortmov post-action.)  Examples (pulled from new
mem64.asm):

    mov ax, [0]                         ; 66 8B 04 25 00 00 00 00
    mov rax, [dword 0]                  ; 48 8B 04 25 00 00 00 00
    mov al, [qword 0xfedcba9876543210]  ; A0 10 32 54 76 98 BA DC FE
    mov al, [0xfedcba9876543210]        ; 8A 04 25 10 32 54 76 (+ warning)
    a32 mov rax, [0]                    ; 67 48 A1 00 00 00 00

* mem64.asm: Update test to match code changes.
* mem64.hex: Likewise.
* mem64.errwarn: Likewise.

Related to: Bugzilla Bug 33
            Reported by: Jeff Lawson <jlawson-yasm@bovine.net>

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

20 years ago* configure.ac, Mkfiles/*/config.h: Stop using date command / CVS string,
Peter Johnson [Wed, 1 Sep 2004 07:10:14 +0000 (07:10 -0000)]
* configure.ac, Mkfiles/*/config.h: Stop using date command / CVS string,
switch to constant use of "HEAD" instead.  This will be replaced by the SVN
tree revision for automated builds.

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

20 years agoMakefile.am: Include mkinstalldirs in the distribution.
Peter Johnson [Wed, 1 Sep 2004 04:55:21 +0000 (04:55 -0000)]
Makefile.am: Include mkinstalldirs in the distribution.

Bugzilla Bug 38
Reported by: Jeff Lawson <jlawson-yasm@bovine.net>

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

20 years ago* COPYING: Revert unintentional change to text of GPL license made in r1127.
Peter Johnson [Mon, 16 Aug 2004 05:12:03 +0000 (05:12 -0000)]
* COPYING: Revert unintentional change to text of GPL license made in r1127.

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

20 years agoltmain.sh: Remove FreeBSD hack that prevents static libraries from being built
Peter Johnson [Sun, 15 Aug 2004 01:46:22 +0000 (01:46 -0000)]
ltmain.sh: Remove FreeBSD hack that prevents static libraries from being built
for modules; this hack breaks static-only builds on FreeBSD.

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

20 years ago* stabs-dbgfmt.c (stabs_dbgfmt_generate_sections):
Peter Johnson [Sun, 15 Aug 2004 00:17:46 +0000 (00:17 -0000)]
* stabs-dbgfmt.c (stabs_dbgfmt_generate_sections):
snprintf is not portable; use strcpy/strcat instead.

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

20 years agoNASM preprocessor's genmacro needs to built differently for cross-building.
Peter Johnson [Sat, 14 Aug 2004 23:49:29 +0000 (23:49 -0000)]
NASM preprocessor's genmacro needs to built differently for cross-building.

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

20 years agoUpdate auto*, libtool, libltdl, and gettext scripts.
Peter Johnson [Sat, 14 Aug 2004 23:07:58 +0000 (23:07 -0000)]
Update auto*, libtool, libltdl, and gettext scripts.
Make cross-building work by changing how re2c and other build tools are
compiled.

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

20 years agoChange from .cvsignore files to svn:ignore directory properties.
Peter Johnson [Sun, 8 Aug 2004 20:12:41 +0000 (20:12 -0000)]
Change from .cvsignore files to svn:ignore directory properties.

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

20 years agoRemove malloc function check; it can need a malloc.c, and thus breaks on
Peter Johnson [Mon, 5 Jul 2004 23:47:48 +0000 (23:47 -0000)]
Remove malloc function check; it can need a malloc.c, and thus breaks on
newer versions of autoconf/automake.

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

20 years agoFixed handling of absolute sections in the elf object format, including
Michael Urman [Fri, 28 May 2004 13:19:48 +0000 (13:19 -0000)]
Fixed handling of absolute sections in the elf object format, including
preventing a segfault.  The assumptions it had made for all sections
were wrong with absolute sections, so added just as much special casing
as necessary.  I hope the output is correct as well - this way we should
at least get bugs if it's wrong.

Reported by: Ben Skeggs <d4rk74m4@intas.net.au>

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

20 years agoAdd support for NASM-compatible ELF extensions to the GLOBAL and COMMON
Peter Johnson [Mon, 17 May 2004 04:20:52 +0000 (04:20 -0000)]
Add support for NASM-compatible ELF extensions to the GLOBAL and COMMON
directives.

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

20 years agoAdd flat Makefile for MINGW cross-compile to Win32.
Peter Johnson [Mon, 10 May 2004 05:39:03 +0000 (05:39 -0000)]
Add flat Makefile for MINGW cross-compile to Win32.

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

20 years agoAdd compile of libyasm/objfmt.c.
Peter Johnson [Mon, 10 May 2004 05:38:30 +0000 (05:38 -0000)]
Add compile of libyasm/objfmt.c.

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

20 years agosnprintf is not portable; use strcpy/strcat instead.
Peter Johnson [Mon, 10 May 2004 05:35:53 +0000 (05:35 -0000)]
snprintf is not portable; use strcpy/strcat instead.

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

20 years agoFix LSS opcode.
Peter Johnson [Tue, 4 May 2004 19:40:15 +0000 (19:40 -0000)]
Fix LSS opcode.

Bugzilla Bug: 36
Reported By: vclaudepierre@tiscali.fr

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

20 years agoAdd rudimentary, untested, AMD64 support.
Peter Johnson [Sun, 11 Apr 2004 23:25:17 +0000 (23:25 -0000)]
Add rudimentary, untested, AMD64 support.
The AMD64 MASM likes to generate REL32 relocations for everything; I've not
yet figured out how this works.
This code should work fine for files without relocation.

Bugzilla bug: 33
Reported by: Jeff Lawson <jlawson-yasm@bovine.net>

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

20 years agoPrevious commit broke build on non-CygWin. Fixed so it now works on both
Peter Johnson [Sat, 3 Apr 2004 19:35:48 +0000 (19:35 -0000)]
Previous commit broke build on non-CygWin.  Fixed so it now works on both
CygWin and non-CygWin machines.

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

20 years agoDisable checking for system-wide ARGZ functions; they're broken on CygWin
Peter Johnson [Sat, 3 Apr 2004 04:26:17 +0000 (04:26 -0000)]
Disable checking for system-wide ARGZ functions; they're broken on CygWin
at the minimum.

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

20 years agoAdd objfmt.c and assocdat.c to libyasm VC++ build.
Peter Johnson [Sat, 3 Apr 2004 03:05:39 +0000 (03:05 -0000)]
Add objfmt.c and assocdat.c to libyasm VC++ build.

Bugzilla bug: 32
Reported by: jlawson-yasm@bovine.net

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

20 years agoFix crash on cygwin due to large on-stack allocation.
Peter Johnson [Sat, 3 Apr 2004 01:25:01 +0000 (01:25 -0000)]
Fix crash on cygwin due to large on-stack allocation.

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

20 years agoInclude nasm-macros.c in the distribution by including it in SOURCES.
Peter Johnson [Sat, 3 Apr 2004 01:24:02 +0000 (01:24 -0000)]
Include nasm-macros.c in the distribution by including it in SOURCES.
This is primarily for users building yasm on Windows using VC++.

Bugzilla bug: 32
Reported by: jlawson-yasm@bovine.net

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

20 years agoActually include needed function replacements in the yasm link.
Peter Johnson [Sat, 3 Apr 2004 01:21:22 +0000 (01:21 -0000)]
Actually include needed function replacements in the yasm link.

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

20 years agoFix indexreg handling in x86_expr_checkea_getregusage() to correctly handle
Peter Johnson [Sat, 27 Mar 2004 03:14:52 +0000 (03:14 -0000)]
Fix indexreg handling in x86_expr_checkea_getregusage() to correctly handle
a non-multiplier used after a multiplier (e.g. edi*8+eax).  Previously,
this resulted in the eax overriding the edi as the indexreg, causing the
effective address not to be recognized.

Update the effaddr testcase to test this case and a few other similar ones.

Bugzilla bug: 31
Reported by: vclaudepierre@tiscali.fr

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

20 years agoFix push in 64-bit mode to take a 32-bit signed immediate rather than a
Peter Johnson [Tue, 16 Mar 2004 08:26:19 +0000 (08:26 -0000)]
Fix push in 64-bit mode to take a 32-bit signed immediate rather than a
64-bit immediate.  Actually, whether it's signed or unsigned seems to be
uncertain; AMD64 documentation shows it as signed, but Intel's new IA-32e
says it's unsigned!  While we're here, the Imm8 version is signed, not
unsigned.

Bugzilla bug: 30
Reported by: Michael Ryan <michaelryan@mindspring.com>

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

20 years agoConvert re2c cleanup.pl to cleanup.c, removing final Perl dependency.
Peter Johnson [Mon, 15 Mar 2004 05:18:07 +0000 (05:18 -0000)]
Convert re2c cleanup.pl to cleanup.c, removing final Perl dependency.
Remove checking for Perl and Perl version in configure.

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

20 years agoConvert NASM preproc macros.pl to genmacro.c, to remove a Perl
Peter Johnson [Mon, 15 Mar 2004 00:27:06 +0000 (00:27 -0000)]
Convert NASM preproc macros.pl to genmacro.c, to remove a Perl
dependency.

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

20 years agoConvert test_hd.pl to test_hd.c, to remove one Perl dependency.
Peter Johnson [Sun, 14 Mar 2004 22:25:18 +0000 (22:25 -0000)]
Convert test_hd.pl to test_hd.c, to remove one Perl dependency.

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

20 years agoComment "Op1Add is only used for FPU, so no need to do REX" is incorrect;
Peter Johnson [Tue, 9 Mar 2004 07:15:53 +0000 (07:15 -0000)]
Comment "Op1Add is only used for FPU, so no need to do REX" is incorrect;
BSWAP uses Op1Add!

Reported by: vclaudepierre@tiscali.fr
Bugzilla bug: 27

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

20 years agoFix handling of >32 bit NASM character constants; they were being shifted
Peter Johnson [Tue, 2 Mar 2004 05:53:30 +0000 (05:53 -0000)]
Fix handling of >32 bit NASM character constants; they were being shifted
an extra time.

Bugzilla bug: 25
Reported by: vclaudepierre@tiscali.fr

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

20 years agoActually include (newly added) basename.c and dirname.c in the distribution.
Peter Johnson [Sun, 8 Feb 2004 02:54:25 +0000 (02:54 -0000)]
Actually include (newly added) basename.c and dirname.c in the distribution.

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

20 years agoMake yasm dynamic module loader able to find modules even when run from a
Peter Johnson [Sat, 7 Feb 2004 22:28:40 +0000 (22:28 -0000)]
Make yasm dynamic module loader able to find modules even when run from a
different location.  The new code uses dirname() to add the argv[0] path to
the LTDL module loader search path.  Added new replacements for dirname and
basename functions from OpenBSD.

Bugzilla: Bug 24
Reported by: Simon Paulger <simonjpaulger@hotmail.com>

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

20 years agoMassive libyasm / module interface update - Phase 2 (finally).
Peter Johnson [Fri, 6 Feb 2004 21:12:56 +0000 (21:12 -0000)]
Massive libyasm / module interface update - Phase 2 (finally).

(Hopefully) finish cleanups begun in phase 1 (see phase 1 commit message),
making dbgfmt, objfmt, optimizer, and preproc module interfaces follow the
same thread-safe interface style as the phase 1 changes.

Also put in a large number of doxygen documentation cleanups.

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

20 years agoInstall assocdat.h along with the other headers.
Peter Johnson [Fri, 6 Feb 2004 21:08:53 +0000 (21:08 -0000)]
Install assocdat.h along with the other headers.

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

20 years agoAdd assocdat.o to flat Makefiles; the VC++ ones will need to be fixed later.
Peter Johnson [Fri, 6 Feb 2004 21:06:34 +0000 (21:06 -0000)]
Add assocdat.o to flat Makefiles; the VC++ ones will need to be fixed later.

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

20 years agoCorrect ordering of legacy prefix and REX prefix for SSE/SSE2 instructions
Peter Johnson [Thu, 5 Feb 2004 08:25:20 +0000 (08:25 -0000)]
Correct ordering of legacy prefix and REX prefix for SSE/SSE2 instructions
in 64-bit (AMD64) mode.  Intel says these bytes should not be treated as
prefixes, but AMD64 treats them as legacy prefixes, expecting them to come
before the REX byte.

For now, keep the three-byte max instruction length (although it's not truly
correct), as handling the other "3-byte" cases such as R/M spare with no EA
is probably more painful than it's worth to push down to later in the code
generation path.

Reported by: Henryk Richter <henryk.richter@comlab.uni-rostock.de>

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

20 years agoFix SIMD VR/PR instruction encoding for the following instructions:
Peter Johnson [Thu, 5 Feb 2004 03:40:16 +0000 (03:40 -0000)]
Fix SIMD VR/PR instruction encoding for the following instructions:
 - PEXTRW
 - MOVMSKPD
 - MOVMSKPS
 - PMOVMSKB
Reported by: Vivek Mohan <vivekm@phreaker.net>

Also, while we're here, fix all CVT* SIMD instructions; they were variously
incorrect (mostly with regards to accepted operands).

New testcase, simd-2, tests all the above (output verified with GNU objdump).

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

21 years agoDelete the output file on error.
Peter Johnson [Fri, 2 Jan 2004 23:57:15 +0000 (23:57 -0000)]
Delete the output file on error.
Bugzilla bug #23

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

21 years agoAdd VC++ 7.1 build files to the distribution.
Peter Johnson [Fri, 26 Dec 2003 08:01:34 +0000 (08:01 -0000)]
Add VC++ 7.1 build files to the distribution.

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

21 years agoAdd VC build files for VC++ 7.1 (untested by myself).
Peter Johnson [Fri, 26 Dec 2003 07:58:02 +0000 (07:58 -0000)]
Add VC build files for VC++ 7.1 (untested by myself).
Currently requires Perl installed as \Program Files\Perl\bin\perl.

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

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

21 years agoAdd command line option (-X) to allow error reporting in the VC IDE format.
Peter Johnson [Fri, 26 Dec 2003 07:53:16 +0000 (07:53 -0000)]
Add command line option (-X) to allow error reporting in the VC IDE format.

Original patch submitted by: Brian Gladman <brg@gladman.plus.com>

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

21 years agoBring non-libtool (VC++) build up to date with libyasm structural changes.
Peter Johnson [Fri, 26 Dec 2003 04:53:44 +0000 (04:53 -0000)]
Bring non-libtool (VC++) build up to date with libyasm structural changes.

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

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

21 years agoAdd a workaround for the lack of per-objfmt macro support to fix the common
Peter Johnson [Tue, 16 Dec 2003 07:45:04 +0000 (07:45 -0000)]
Add a workaround for the lack of per-objfmt macro support to fix the common
use of the ORG macro (several user comments about the lack of this) and the
initial value of the __SECT__ macro (used by ENDSTRUC among other macros).
Fortunately, for all current objfmts, __SECT__ is currently defined as
[section .text], so one common definition can be used for now.

FIXME: remove this workaround when a better solution has been implemented.

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

21 years agoProperly handle fatal errors (like missing include file) from the real
Peter Johnson [Tue, 16 Dec 2003 03:54:15 +0000 (03:54 -0000)]
Properly handle fatal errors (like missing include file) from the real
NASM parser by changing the libyasm yasm_fatal() interface to use va_list
instead of ... variable arguments.  Add a yasm__fatal() function that takes
... and calls yasm_fatal().

Bugzilla bug #22
Reported by: mu@tortall.net

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

21 years agoEnable elf support for extended section attribute align=foo parameters.
Michael Urman [Tue, 2 Dec 2003 06:27:53 +0000 (06:27 -0000)]
Enable elf support for extended section attribute align=foo parameters.
It had previously been mysteriously if(0)'d out.

Reported By: Edouard Gomez <ed.gomez@free.fr>

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

21 years agoFix stabs to always use stab size 12, n_value size 4. Truncate 64bit
Michael Urman [Tue, 4 Nov 2003 20:05:50 +0000 (20:05 -0000)]
Fix stabs to always use stab size 12, n_value size 4.  Truncate 64bit
values into 32bits as necessary.  This is the proper fix to "written
length does not match optimized length" in amd64+stabs.

Reported by Jeff Lawson <jlawson-yasm@bovine.net>

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

21 years ago"Fix" stabs to always output the same stab length in stabs_bc_stab_tobytes.
Michael Urman [Tue, 4 Nov 2003 19:52:02 +0000 (19:52 -0000)]
"Fix" stabs to always output the same stab length in stabs_bc_stab_tobytes.
Previously only "symvalue" stabs did this, causing a mismatched output size
with amd64 and stabs.  However since it appears the actual stabs spec always
uses 12 byte stabs, this fix is already obsolete and will be superceded
shortly.

Reported By: Jeff Lawson <jlawson-yasm@bovine.net>

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