]> granicus.if.org Git - yasm/log
yasm
19 years agoRather than pulling the objfmt keyword back from the objfmt when setting
Peter Johnson [Fri, 16 Dec 2005 06:06:25 +0000 (06:06 -0000)]
Rather than pulling the objfmt keyword back from the objfmt when setting
__YASM_OBJFMT__, use whatever name was specified on the command line.  This
also matches the behavior of yasm preprocess-only mode (-e).  Both the
mismatch between preproc/non-preproc and the internal name change (e.g. from
elf to elf32) were quite confusing.

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

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

19 years agore2c.vcproj: Fix win32 build of re2c by including mbo_getopt.
Peter Johnson [Tue, 13 Dec 2005 07:10:57 +0000 (07:10 -0000)]
re2c.vcproj: Fix win32 build of re2c by including mbo_getopt.

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

19 years agoAvoid crash in section_switch for a number of object formats.
Peter Johnson [Sat, 3 Dec 2005 18:04:59 +0000 (18:04 -0000)]
Avoid crash in section_switch for a number of object formats.

Noticed by: Catalin Ionescu <catalin.ionescu@radioconsult.ro>

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

19 years ago* coff-objfmt.c (coff_objfmt_output_secthead): Use sprintf instead of
Peter Johnson [Wed, 30 Nov 2005 06:53:06 +0000 (06:53 -0000)]
* coff-objfmt.c (coff_objfmt_output_secthead): Use sprintf instead of
snprintf when outputting /nnn section names; snprintf doesn't port well
to mingw at least.  This also generates more correct output (fills with 0s).

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

19 years ago* coff-objfmt.c: Support section names >8 characters when outputting Win32
Peter Johnson [Wed, 23 Nov 2005 07:27:41 +0000 (07:27 -0000)]
* coff-objfmt.c: Support section names >8 characters when outputting Win32
or Win64 object files, which support a string table extensison of section
names.

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

19 years ago* coff-objfmt.c (coff_objfmt_section_switch): First cut at mimicing GAS coff
Peter Johnson [Wed, 16 Nov 2005 05:10:44 +0000 (05:10 -0000)]
* coff-objfmt.c (coff_objfmt_section_switch): First cut at mimicing GAS coff
flags.

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

19 years agoMove section alignment to libyasm, refactoring it from individual object
Peter Johnson [Sun, 13 Nov 2005 20:44:21 +0000 (20:44 -0000)]
Move section alignment to libyasm, refactoring it from individual object
formats.

* section.h (yasm_object_get_general): Add align parameter.
(yasm_section_set_align, yasm_section_get_align): New.
* section.c (yasm_section): Add align member and implementations.

* objfmt.h (yasm_objfmt_section_align): Remove.

* gas-bison.y (gas_parser_align): Change to use yasm_section_get/set_align().

* xdf, elf, bin, dbg, coff, stabs: Refactor as necessary.

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

19 years agoIn GAS mode, detect sections that are marked as contain code thanks to "x"
Peter Johnson [Fri, 11 Nov 2005 04:31:20 +0000 (04:31 -0000)]
In GAS mode, detect sections that are marked as contain code thanks to "x"
flag, not just sections named ".text".

* section.h (yasm_object_get_general): Add code flag parameter to indicate
if section is intended to contain code.
(yasm_section_is_code): New, to get value of code flag.
* section.c (yasm_section): Add flag to section structure.
(yasm_object_get_general, yasm_section_is_code): Implement flag.

* *-objfmt.c, stabs-dbgfmt.c: Update call to yasm_object_get_general,
setting code flag appropriately (only elf *really* handles this correctly,
coff still needs to handle GAS flags to work fully from GAS mode).

* gas-parser.h (yasm_parser_gas): Remove code_section flag.
* gas-bison.y (gas_switch_section): Don't set.
(gas_parser_align): Use yasm_section_is_code() instead of code_section flag.
* gas-parser.c: Don't initialize code_section flag.

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

19 years agoFix GAS section alignment, at least for ELF output. In GAS mode, the
Peter Johnson [Wed, 9 Nov 2005 06:05:58 +0000 (06:05 -0000)]
Fix GAS section alignment, at least for ELF output.  In GAS mode, the
section alignment is set to the maximum alignment used anywhere in the
section.

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

19 years agoUnbreak distcheck.
Peter Johnson [Tue, 8 Nov 2005 03:44:38 +0000 (03:44 -0000)]
Unbreak distcheck.

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

19 years agoAdd ability for GAS input to set section alignment in the same way GAS does:
Peter Johnson [Mon, 7 Nov 2005 06:53:52 +0000 (06:53 -0000)]
Add ability for GAS input to set section alignment in the same way GAS does:
if the first thing in the section is a .align, that specifies the section
alignment.

* objfmt.h (yasm_objfmt_module): Add section_align() function.
(yasm_objfmt_section_align): Add wrapper for module section_align().
* xdf-objfmt.c, elf-objfmt.c, bin-objfmt.c, dbg-objfmt.c, coff-objfmt.c:
Implement.

* gas-bison.y (gas_parser_align): Call new yasm_objfmt_section_align() rather
than creating an align bytecode if .align is the first bytecode in the
section.

* gassectalign.asm: New test for this.

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

19 years agoChange some optimization settings so that imm8 optimizations actually get
Peter Johnson [Mon, 7 Nov 2005 05:12:22 +0000 (05:12 -0000)]
Change some optimization settings so that imm8 optimizations actually get
triggered for more cases and optimize from 64-bit down to 32-bit for 64-bit
mov instructions.  This change means that mov reg64, constant will be
auto-sized up to 64 bits, but mov reg64, expr/symbol will default to 32 bits.
You must use mov reg64, qword expr/symbol if you need 64 bits, or in GAS
mode use movabsq expr/symbol, reg64.

This makes the generated code smaller and default most usages into 32-bit
relocations appropriate for ELF64 and Win64.  Right now, 32-bit unsigned
relocs are generated instead of 32-bit signed; this will need to be fixed.

* x86arch.h (x86_insn.postop): Add X86_POSTOP_SIGNEXT_IMM32.
* x86bc.c (x86_bc_insn_resolve): Implement.
* x86id.re (OPAP_SImm32Avail): New flag.
(MOD_Op2AddSp): New modifier to encode spare directly into 2nd opcode byte.
(arith_insn): Use MOD_Op2AddSp and add forced-size override forms.
(mov_insn): Use OPAP_SImm32Avail and add forced-size override form.
(yasm_x86__finalize_insn): Implement new flag and modifier.

Fix up testcases for changes.

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

19 years agoFix common and 0-offset local definition of symbol. The symbol would end
Peter Johnson [Sun, 6 Nov 2005 20:27:49 +0000 (20:27 -0000)]
Fix common and 0-offset local definition of symbol.  The symbol would end
up with the alignment as the offset rather than 0.  The cause of this was
that elf_sym_set_nonzero was getting a 0 offset which it then did not set.

* elf.c (elf_symtab_set_nonzero): Make value a pointer so that 0 values
can actually get set if necessary.
* elf.h (elf_symtab_set_nonzero): Update prototype.
* elf-objfmt.c (elf_objfmt_symtab_append): Likewise, and ripple changes.

* elf_gas64_reloc.hex: Update (now is correct).

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

19 years agoAdd test output file missed in previous commit. Note this output currently
Peter Johnson [Sun, 6 Nov 2005 20:08:48 +0000 (20:08 -0000)]
Add test output file missed in previous commit.  Note this output currently
contains an error due to another bug (will be fixed shortly).

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

19 years agoFix ELF64 relocations for common, global, and common+global symbols to match
Peter Johnson [Sun, 6 Nov 2005 20:07:15 +0000 (20:07 -0000)]
Fix ELF64 relocations for common, global, and common+global symbols to match
GAS output.  The way we were generating relocations before would make
common+global symbol usage generate a relocation against the symbol but
figure in the symbol's value into the relocation addend.

* expr.h (yasm_symrec_relocate_action): New enum, so that:
(yasm_expr_extract_symrec): can conditionalize replacing the symbol with its
value based on whether the symbol is only local (e.g. not declared global,
etc).
* expr.c (yasm_expr_extract_symrec): Update implementation.

* xdf-objfmt.c, coff-objfmt.c: Update to use new enum constants.

* elf-objfmt.c (elf_objfmt_output_expr): Only relocate against section if
symbol is only local, and change call to yasm_expr_extract_symrec to only
add in symbol value if symbol is only local.

* stabs-elf.hex, elftest.hex: Update for changes.

* elf_gas64_reloc.asm: New test.

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

19 years ago* gas-bison.y: Fix a couple use-after-free's.
Peter Johnson [Sat, 5 Nov 2005 20:44:40 +0000 (20:44 -0000)]
* gas-bison.y: Fix a couple use-after-free's.

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

19 years agoHandle instruction and prefix identifiers properly when used in other
Peter Johnson [Thu, 3 Nov 2005 05:29:42 +0000 (05:29 -0000)]
Handle instruction and prefix identifiers properly when used in other
places in GAS input.  Do this by adding a tokenizer state that turns off
insn and prefix generation when inside an instruction or directive, AND
adding a special case for labels.

* gas-parser.h (state): Add INSTDIR.
* gas-token.re: Switch state back to INITIAL on ';' or newline; set state
when entering instruction or directive, add special case for labels.
* gas-bison.y: Remove non-working attempt at translating INSN and PREFIX
into string token; add special case for LABEL identifiers (generated from
special case for labels in tokenizer).

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

19 years ago* symrec.c (symrec_define): Don't error if a symbol is declared common and
Peter Johnson [Thu, 3 Nov 2005 04:38:21 +0000 (04:38 -0000)]
* symrec.c (symrec_define): Don't error if a symbol is declared common and
then defined, and warn instead of error if a symbol is declared global and
then defined.

* externdef.asm: Test for the warning.

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

19 years agoAdd warning class (YASM_WARN_UNINIT_CONTENTS) to turn off the
Peter Johnson [Thu, 3 Nov 2005 03:49:10 +0000 (03:49 -0000)]
Add warning class (YASM_WARN_UNINIT_CONTENTS) to turn off the
"uninitialized data in code/data section: zeroing" warning.  This can now
be turned off using -Wno-uninit-contents on the command line.

* errwarn.h (yasm_warn_class): Add warning class.
* errwarn.c (yasm_errwarn_initialize): Default it to enabled.

* yasm.c (opt_warning_handler): Add as option.

* xdf-objfmt.c, elf-objfmt.c, bin-objfmt.c, coff-objfmt.c: Change warning
class for this warning.

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

19 years agoAdd support for single-level GAS .rept directive. Nested .rept's are not
Peter Johnson [Wed, 2 Nov 2005 08:24:19 +0000 (08:24 -0000)]
Add support for single-level GAS .rept directive.  Nested .rept's are not
allowed at the moment.  The implementation works mostly like a preproc; it
copies source lines and replays them to the lexer.  A new .line directive
was added to fix up line numbers for errors and warnings.

* gas-parser.h (yasm_parser_gas): Add rept structure storage.
(gas_rept): New data structure for .rept state.
(gas_rept_line): Data structure to store source lines within .rept block.

* gas-parser.c: Initialize rept to NULL and check for unclosed rept.

* gas-bison.y: Add support for .line, .rept, and .endr directives.  The
DIR_REPT handler just creates the rept structure, and the DIR_ENDR handler
just errors (.endr without .rept).  All the real work is done in the lexer.

* gas-token.re (rept_input): Replays captured .rept block source lines back
to fill().
(fill): Call rept_input() instead of yasm_preproc_input() if expanding a
rept block.
(gas_parser_lex): Capture source lines and store into rept data structures.

Also added a whole bunch of testcases.

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

19 years ago* libyasm.h (yasm_linemap_set): Allow NULL filename to indicate unchanged.
Peter Johnson [Wed, 2 Nov 2005 08:14:01 +0000 (08:14 -0000)]
* libyasm.h (yasm_linemap_set): Allow NULL filename to indicate unchanged.
* libyasm.c (yasm_linemap_set): Implement.

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

19 years agoFix the use of ELF type/size directives with local variables.
Peter Johnson [Tue, 1 Nov 2005 08:26:19 +0000 (08:26 -0000)]
Fix the use of ELF type/size directives with local variables.

* elf.h (elf_symtab_entry): Add in_table flag.
(elf_sym_in_table): New.
* elf.c (elf_symtab_entry_create): Initialize in_table to 0.
(elf_symtab_append_entry, elf_symtab_insert_local_sym): Set flag to 1.

* elf.c (elf_symtab_insert_local_sym): Don't create the entry here, instead
take it as a parameter.

* elf-objfmt.c (elf_objfmt_symtab_append): Only add if not in table by
checking new in_table flag.
(elf_objfmt_append_local_sym): Likewise, and pull some of the logic from
the old elf_symtab_insert_local_sym function to do it.
(elf_objfmt_directive): Don't append to ELF symbol table here, as we don't
know yet if the variable is global or local.

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

19 years ago* assocdat.c (yasm__assoc_data_add): Add safety valve: don't delete existing
Peter Johnson [Tue, 1 Nov 2005 05:29:34 +0000 (05:29 -0000)]
* assocdat.c (yasm__assoc_data_add): Add safety valve: don't delete existing
data if we're getting passed in the same data pointer.

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

19 years ago* elf.c (elf_symtab_create): Default type to STT_NOTYPE.
Peter Johnson [Tue, 1 Nov 2005 04:48:15 +0000 (04:48 -0000)]
* elf.c (elf_symtab_create): Default type to STT_NOTYPE.
* elf-objfmt.c (elf_objfmt_append_local_sym, elf_objfmt_extern_declare)
(elf_objfmt_global_declare, elf_objfmt_common_declare)
(elf_objfmt_directive): Only override if actually required.

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

19 years agoAdd macros for ELF's type, size, and weak directives.
Peter Johnson [Tue, 1 Nov 2005 04:36:44 +0000 (04:36 -0000)]
Add macros for ELF's type, size, and weak directives.

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

19 years ago* elf-objfmt.c (elf_objfmt_symtab_append): Don't append symbol a second
Peter Johnson [Tue, 1 Nov 2005 04:23:54 +0000 (04:23 -0000)]
* elf-objfmt.c (elf_objfmt_symtab_append): Don't append symbol a second
time if it already has associated data.  This keeps global followed by
extern from generating duplicate symbol table entries.

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

19 years agoFix implementation of r1298 and fixup testcases.
Peter Johnson [Tue, 1 Nov 2005 03:57:42 +0000 (03:57 -0000)]
Fix implementation of r1298 and fixup testcases.
* gas-bison.y (gas_get_section, gas_switch_section): Add parameter builtin
to indicate gas flags should not be generated.

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

19 years agoFix linker errors with GAS parser directives .data/.text/etc.
Peter Johnson [Tue, 1 Nov 2005 03:37:44 +0000 (03:37 -0000)]
Fix linker errors with GAS parser directives .data/.text/etc.
* gas-bison.y (gas_get_section): Don't create empty gas flags unless type
is also specified.  This fixes .data/.text/etc section flags.
* elf-objfmt.c (elf_objfmt_section_switch): Add default flags for .comment
section; this is needed so the above change doesn't break .ident.

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

19 years ago* x86id.re: Fix typo that broke fcmovu and left fcmovnu unimplemented.
Peter Johnson [Sun, 30 Oct 2005 23:58:10 +0000 (23:58 -0000)]
* x86id.re: Fix typo that broke fcmovu and left fcmovnu unimplemented.
* fcmov.asm: New test for all FCMOV instructions.

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

19 years agoMake negative times value an error case.
Peter Johnson [Sun, 30 Oct 2005 06:15:15 +0000 (06:15 -0000)]
Make negative times value an error case.

* bytecode.c (yasm_bc_resolve, yasm_bc_tobytes): Look for negative multiple.

* timesover-err.asm: New testcase for this.

Reported by: Stefan <SMarF@gmx.de>

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

19 years ago* intnum.c (yasm_intnum_is_zero, yasm_intnum_is_pos1, yasm_intnum_is_neg1)
Peter Johnson [Sun, 30 Oct 2005 06:13:24 +0000 (06:13 -0000)]
* intnum.c (yasm_intnum_is_zero, yasm_intnum_is_pos1, yasm_intnum_is_neg1)
(yasm_intnum_sign): Constize intnum parameter.
* intnum.h: Update prototypes for above.

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

19 years ago* bytecode.h (yasm_dv_create_string): Fix up documentation.
Peter Johnson [Thu, 27 Oct 2005 03:34:54 +0000 (03:34 -0000)]
* bytecode.h (yasm_dv_create_string): Fix up documentation.

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

19 years agoEnhance builtin bytecode_data to support embedded NULs in character strings.
Peter Johnson [Wed, 26 Oct 2005 03:22:44 +0000 (03:22 -0000)]
Enhance builtin bytecode_data to support embedded NULs in character strings.
While NASM doesn't allow this, GAS does.

While we're here, greatly clean up GAS data bytecode creation by no longer
building intermediate valparam list.

* bytecode.h (yasm_dv_create_string): Add length parameter.
(yasm_bc_create_data): Add append_zero parameter for new ability to append
a single ero byte after each data value.  This is used by the GAS .asciz
directive.
* bytecode.c (bytecode_data, ...): Implement the above.

* gas-bison.y (gas_define_strings, gas_define_data)
(gas_define_leb128): Remove; replace in usage with direct calls to bytecode
functions.  Add str, dataval, and datavalhead to parser union.  Add new
dirvals, which has valparams type, and change strvals and datavals to
datavals type.
* gas-token.re: Use new str type where STRING token is generated.

* nasm-bison.y: Add str type to union, and use for STRING token.
* nasm-token.re: Use new str type where STRING token is generated.

* coff-objfmt.c (win32_objfmt_directive): Adjust for updates to
bytecode_data.

* strzero.asm: Simple test for NUL in GAS string.

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

19 years agoSupport standalone, segment, and REX prefixes in GAS mode.
Peter Johnson [Mon, 24 Oct 2005 04:48:37 +0000 (04:48 -0000)]
Support standalone, segment, and REX prefixes in GAS mode.
* bytecode.c (yasm_bc_create_empty_insn): New function to create empty
instruction that can have prefixes applied to it, for standalone prefixes.
* bytecode.h (yasm_bc_create_empty_insn): Prototype.

* x86arch.h (x86_parse_insn_prefix): Add prefix types for segment registers
(X86_SEGREG) and REX bytes (X86_REX).
(yasm_x86__bc_apply_prefixes): Adjust prototype to include REX pointer (as
this isn't in the x86_common structure).
* x86bc.c (yasm_x86__bc_apply_prefixes): Support the new prefix types.

* x86id.re (x86_finalize_*): Use const x86_insn_info; all insn_infos are
const so these pointers should be as well.
(yasm_x86__finalize_insn): Handle empty instruction case by pointing to new
empty_insn info.
(empty_insn): New.
(yasm_x86__parse_check_prefix): Support GAS prefix naming, and REX and jump
hint prefixes (only in GAS mode at the moment).

* gas-bison.y: Add rules to handle segreg prefixes as well as standalone
prefixes (both segreg and others).

* gas-prefix.asm: New testcase that also hits the warning cases in
yasm_x86__bc_apply_prefixes X86_REX case.

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

19 years ago* gas-bison.y, gas-token.re: Support multiple instructions on a single line
Peter Johnson [Sun, 23 Oct 2005 06:01:44 +0000 (06:01 -0000)]
* gas-bison.y, gas-token.re: Support multiple instructions on a single line
with ';' separator.  List output with this is currently broken however.

* gas-semi.asm: New test for this.

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

19 years ago* gas-token.re (strbuf_append): Allocate before store (otherwise crash is
Peter Johnson [Wed, 19 Oct 2005 07:57:32 +0000 (07:57 -0000)]
* gas-token.re (strbuf_append): Allocate before store (otherwise crash is
possible).

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

19 years ago* gas-bison.y: Add support for .value alias for .2byte (GAS-x86/amd64).
Peter Johnson [Wed, 19 Oct 2005 07:44:59 +0000 (07:44 -0000)]
* gas-bison.y: Add support for .value alias for .2byte (GAS-x86/amd64).
This is generated by GCC in debug sections.
* gas-token.re: Likewise.

* gas-bison.y: Add support for 4th parameter on .section directive, for use
with M (SHF_MERGE) ELF section flag.
* elf-objfmt.c: Add support for M, S (SHF_STRINGS), G (SHF_GROUP), and T
(SHF_TLS) section flags.
* elf.h: Declare additional SHF_* flags.

With these changes, debug information generated by GCC in GAS format is
passed through successfully.  Should just need line number generation to
have full debugging for ELF-DWARF2 coming from GCC.

Only remaining thing to handle that I see at the moment for full GCC output
support is multiple instructions on one line (separated by semicolons).

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

19 years ago* elf-x86-amd64.c (elf_x86_amd64_write_reloc): Fix a crash with ELF: when an
Peter Johnson [Wed, 19 Oct 2005 07:18:20 +0000 (07:18 -0000)]
* elf-x86-amd64.c (elf_x86_amd64_write_reloc): Fix a crash with ELF: when an
invalid relocation is generated, this still gets called but with a NULL
addend.

* expr.c (expr_xform_bc_dist): Check return value of yasm_symrec_get_label()
to avoid crash.

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

19 years agoAdd support for LEB128 encoded integers (both signed and unsigned). This
Peter Johnson [Mon, 17 Oct 2005 07:43:16 +0000 (07:43 -0000)]
Add support for LEB128 encoded integers (both signed and unsigned).  This
is needed for the GAS .uleb128 and .sleb128 directives.

* intnum.c (yasm_intnum_sign): New signedness discovery function.
* intnum.h (yasm_intnum_sign): Prototype.

* intnum.c (yasm_intnum_get_leb128, yasm_intnum_size_leb128): New.
* intnum.h (yasm_intnum_get_leb128, yasm_intnum_size_leb128): Prototype.
* leb128_test.c: New test for intnum-level LEB128 functions.

* bytecode.c (bytecode_leb128): New bytecode and supporting functions.
(yasm_bc_create_leb128): New creation function.
* bytecode.h (yasm_bc_create_leb128): Prototype.

* gas-token.re: Recognize .uleb128 and .sleb128.
* gas-bison.y: Ditto.
(gas_define_leb128): New.
* leb128.asm: New test for GAS .uleb128 and .sleb128 directives.

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

19 years ago* gas-bison.y, gas-token.re: Implement .weak directive.
Peter Johnson [Sun, 16 Oct 2005 08:48:24 +0000 (08:48 -0000)]
* gas-bison.y, gas-token.re: Implement .weak directive.

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

19 years ago* gas-bison.y: Implement .type and .size directives.
Peter Johnson [Sun, 16 Oct 2005 08:45:11 +0000 (08:45 -0000)]
* gas-bison.y: Implement .type and .size directives.
* elf-objfmt.c (elf_objfmt_directive): Implement type/size/weak for ELF output.
* elf.h (elf_sym_set_type, elf_sym_set_size): Supporting functions.
* elf.c (elf_sym_set_type, elf_sym_set_size): Implement.

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

19 years ago* Makefile.am: Actually include Mkfiles/dj/_stdint.h in the distribution.
Peter Johnson [Sat, 15 Oct 2005 19:40:15 +0000 (19:40 -0000)]
* Makefile.am: Actually include Mkfiles/dj/_stdint.h in the distribution.

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

19 years ago* Makefile.flat, Makefile.dj: Further enhance flat/DJGPP Makefiles to build
Peter Johnson [Sat, 15 Oct 2005 04:39:32 +0000 (04:39 -0000)]
* Makefile.flat, Makefile.dj: Further enhance flat/DJGPP Makefiles to build
re2c.  Now the only thing not built with these is the Bison parsers.

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

19 years ago* x86id.re: Fix basic uses of pop suffixes for GAS mode.
Peter Johnson [Sat, 15 Oct 2005 03:18:47 +0000 (03:18 -0000)]
* x86id.re: Fix basic uses of pop suffixes for GAS mode.

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

19 years agoResync alternate build Makefiles with tree changes.
Peter Johnson [Fri, 14 Oct 2005 03:21:54 +0000 (03:21 -0000)]
Resync alternate build Makefiles with tree changes.

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

19 years ago* x86bc.c (x86_bc_insn_resolve): Fix loss of precision on yasm_intnum_get_int
Peter Johnson [Thu, 13 Oct 2005 07:17:15 +0000 (07:17 -0000)]
* x86bc.c (x86_bc_insn_resolve): Fix loss of precision on yasm_intnum_get_int
return value on 64-bit machines that could cause incorrect optimization.

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

19 years ago* x86id.re (DEF_INSN_DATA, yasm_x86__parse_check_insn): Perform a few minor
Peter Johnson [Mon, 10 Oct 2005 05:55:21 +0000 (05:55 -0000)]
* x86id.re (DEF_INSN_DATA, yasm_x86__parse_check_insn): Perform a few minor
optimizations to reduce yasm code size.

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

19 years ago* nasm-pp.c, x86id.re: Remove a couple of unused variables.
Peter Johnson [Mon, 10 Oct 2005 05:13:47 +0000 (05:13 -0000)]
* nasm-pp.c, x86id.re: Remove a couple of unused variables.

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

19 years agore2c: Unbreak distcheck.
Peter Johnson [Mon, 10 Oct 2005 05:11:46 +0000 (05:11 -0000)]
re2c: Unbreak distcheck.

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

19 years agoUpdate all re2c input files to use case-insensitive strings. The code
Peter Johnson [Mon, 10 Oct 2005 03:47:58 +0000 (03:47 -0000)]
Update all re2c input files to use case-insensitive strings.  The code
generated for this is identical to the old A=[aA] way of doing this, but
this way is easier to read.

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

19 years agore2c: Finish update to latest version.
Peter Johnson [Sun, 9 Oct 2005 21:56:14 +0000 (21:56 -0000)]
re2c: Finish update to latest version.

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

19 years agore2c: Fix yyaccept warnings.
Peter Johnson [Sun, 9 Oct 2005 20:29:00 +0000 (20:29 -0000)]
re2c: Fix yyaccept warnings.

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

19 years agoContinue re2c updates. This one gets rid of the unused label warnings.
Peter Johnson [Sun, 9 Oct 2005 07:11:45 +0000 (07:11 -0000)]
Continue re2c updates.  This one gets rid of the unused label warnings.
Going ahead and removing the cleanup script; a later commit will get rid
of the remaining unused variable warnings that the cleanup script took care
of as well.

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

19 years ago* cleanup.c: Add strdup implementation as strdup is nonstandard C.
Peter Johnson [Sun, 9 Oct 2005 06:10:03 +0000 (06:10 -0000)]
* cleanup.c: Add strdup implementation as strdup is nonstandard C.

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

19 years agoUpdate re2c to May 12, 2004 version. This adds an output file option, so
Peter Johnson [Sun, 9 Oct 2005 06:08:02 +0000 (06:08 -0000)]
Update re2c to May 12, 2004 version.  This adds an output file option, so
also adjust cleanup program to take input/output file name, and update
Makefiles to use it in this fashion.

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

19 years ago* re2c: Start syncing back up to re2c HEAD. This gets us up to 2004-03-29.
Peter Johnson [Sun, 9 Oct 2005 00:50:31 +0000 (00:50 -0000)]
* re2c: Start syncing back up to re2c HEAD. This gets us up to 2004-03-29.

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

19 years ago* x86arch.h (x86_insn): Combine shift_op, signext_imm8_op, shortmov_op, and
Peter Johnson [Fri, 7 Oct 2005 05:15:52 +0000 (05:15 -0000)]
* x86arch.h (x86_insn): Combine shift_op, signext_imm8_op, shortmov_op, and
address16_op flags into a single postop enum.
* x86id.re (yasm_x86__finalie_insn): Set new enum rather than flags.
* x86bc.c: Use new combined enum.

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

19 years ago* x86id.re: Add support for VIA PadLock instructions.
Peter Johnson [Fri, 7 Oct 2005 03:35:33 +0000 (03:35 -0000)]
* x86id.re: Add support for VIA PadLock instructions.
* padlock.asm: New testcase for these instructions.

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

19 years ago* x86id.re: Add support for AMD Pacifica (Secure Virtual Machine) insns.
Peter Johnson [Fri, 7 Oct 2005 02:55:32 +0000 (02:55 -0000)]
* x86id.re: Add support for AMD Pacifica (Secure Virtual Machine) insns.
* svm.asm: New test for AMD Pacifica instructions.

* x86id.re: Support vmread and vmwrite GAS syntax.

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

19 years ago* x86id.re: Implement string, protection, SSE2 instructions for GAS mode.
Peter Johnson [Wed, 5 Oct 2005 06:57:37 +0000 (06:57 -0000)]
* x86id.re: Implement string, protection, SSE2 instructions for GAS mode.
While we're here, add 64-bit register versions of SSE2 instructions movmskps,
pextrw, pinsrw, and pmovmskb that are documented by Intel but not AMD.

Add test for above.

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

19 years ago* bytecode.c (bc_align_tobytes): Handle cases where some code fills don't
Peter Johnson [Mon, 3 Oct 2005 06:49:15 +0000 (06:49 -0000)]
* bytecode.c (bc_align_tobytes): Handle cases where some code fills don't
exist (this happens in LC3b).
* lc3barch.c (lc3b_get_fill): NOP pattern is actually all 0's.

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

19 years agoImplement align and org bytecodes. While we're here, implement .zero
Peter Johnson [Mon, 3 Oct 2005 05:52:04 +0000 (05:52 -0000)]
Implement align and org bytecodes.  While we're here, implement .zero
directive for GAS (it's generated by GCC).

* bytecode.c (bytecode_align): Update for full align implementation.
(yasm_bc_create_align): Likewise.
(bc_align_finalize): New.
(bc_align_resolve, bc_align_tobytes): Real implementation.
* bytecode.h (yasm_bc_create_align): Update to match.
* arch.h (get_fill, yasm_arch_get_fill): New, to get NOP fill patterns.
* x86arch.c (x86_get_fill): Implement.
* lc3barch.c (lc3b_get_fill): Likewise (probably buggy, there's no real NOP).

* bytecode.c (bytecode_org): New org bytecode.
(bc_org_callback, bc_org_destroy, bc_org_print, bc_org_resolve)
(bc_org_tobytes, yasm_bc_create_org): Implement.

* gas-parser.h (yasm_parser_gas): Add code_section flag to indicate when to
use code fill vs. data fill.
* gas-parser.c: Initialize flag.
* gas-bison.y: Update flag in various places.  Generate org bytecode.
Call gas_parser_align to generate align bytecode.
(gas_parser_align): Generate align bytecode.

* gas-bison.y: Implement .zero directive.
* gas-token.re: Likewise.

* align32, align64: New tests to test align directive NOP generation.

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

19 years ago* x86id.re (push_insn): Turn on signed 8-bit optimization for GAS mode.
Peter Johnson [Mon, 3 Oct 2005 00:12:08 +0000 (00:12 -0000)]
* x86id.re (push_insn): Turn on signed 8-bit optimization for GAS mode.
Don't do this yet for NASM mode; this could be done e.g. through use of
the strict modifier.

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

19 years ago* x86id.re (push_insn, incdec_insn): Fix for GAS parser.
Peter Johnson [Sun, 2 Oct 2005 20:38:29 +0000 (20:38 -0000)]
* x86id.re (push_insn, incdec_insn): Fix for GAS parser.

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

19 years ago* x86id.re (test_insn): Add GAS suffix flags.
Peter Johnson [Sun, 2 Oct 2005 02:31:26 +0000 (02:31 -0000)]
* x86id.re (test_insn): Add GAS suffix flags.

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

19 years ago* x86bc.c (yasm_x86__ea_create_expr, yasm_x86__ea_create_imm): Initialize
Peter Johnson [Sun, 2 Oct 2005 02:30:08 +0000 (02:30 -0000)]
* x86bc.c (yasm_x86__ea_create_expr, yasm_x86__ea_create_imm): Initialize
ea.strong to 0.

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

19 years agoTurn on export macro for win64 in addition to win32.
Peter Johnson [Sat, 1 Oct 2005 16:35:27 +0000 (16:35 -0000)]
Turn on export macro for win64 in addition to win32.

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

19 years agoRevert [1251]. From further investigation, ML64's generation of REL32 in
Peter Johnson [Sat, 1 Oct 2005 05:47:54 +0000 (05:47 -0000)]
Revert [1251].  From further investigation, ML64's generation of REL32 in
these cases seems to be a bug.  If you get a linker error about ADDR32, it
means you aren't using RIP-relative instructions.  Note this means to access
an array you need to do:
  lea rax, [var wrt rip] ; generates RIP-relative insn and REL32 reloc
  mov rcx, [rax+rbx]     ; rbx is index
and not:
  mov rcx, [var+rbx]     ; generates ADDR32 reloc
At least when trying to build a DLL (the ADDR32 reloc fails the DLL link).
When building statically, ADDR32 should work okay and thus the latter form
can be used.

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

19 years ago* coff-objfmt.c (coff_objfmt_output_expr): Try to match the new ML64's
Peter Johnson [Fri, 30 Sep 2005 04:03:59 +0000 (04:03 -0000)]
* coff-objfmt.c (coff_objfmt_output_expr): Try to match the new ML64's
output better by generating relocs directly to the symbol being relocated
rather than to the section.  Use a new coff_objfmt->win64 flag to
conditionalize this rather than just COFF_MACHINE_AMD64.
(coff_objfmt): New win64 flag.
(coff_objfmt_create, win32_objfmt_create, win64_objfmt_create): Initialize
flag.
(coff_objfmt_output): Turn on outputting all symbols in win64 mode so they
can be referenced by relocs.  This isn't quite correct: we should only turn
on the symbols that are actually used by relocs, but having them there
doesn't hurt linking; it only exposes all of the internal symbol names.

With these changes, yasm output matches the new ML64 output except for a
very few cases:
 - ML64 generates REL32 relocs when referencing objects in the same .text
section.  I cannot see how this is necessary because call instructions
don't generate REL32 relocs!  I currently do not plan on fixing this unless
it causes a problem.
 - ML64 generates ADDR32 relocs instead of REL32 relocs when loading a
32-bit register with the address of an object.  I will probably try to fix
this.

Extended test case for this a bit.

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

19 years ago* x86id.re: Unbreak movq for NASM parser. I accidentally overrode it when
Peter Johnson [Thu, 29 Sep 2005 05:13:26 +0000 (05:13 -0000)]
* x86id.re: Unbreak movq for NASM parser.  I accidentally overrode it when
defining the mov forms for GAS.  While I'm here, fix movq so it also
supports the 64-bit move registers (per Intel's spec, AMD has it under movd)
and copy the MMX/SSE2 versions of movq into mov so they're visible to the
GAS parser (and only the GAS parser).

Add a whole bunch of testcases to test movd and movq in both 32 bit and 64
bit modes for both GAS and NASM parsers.

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

19 years ago* Fix win64/tests/Makefile.inc that was causing distcheck breakage.
Peter Johnson [Thu, 29 Sep 2005 05:10:29 +0000 (05:10 -0000)]
* Fix win64/tests/Makefile.inc that was causing distcheck breakage.

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

19 years agoUpdate VC build files for GAS parser.
Peter Johnson [Wed, 28 Sep 2005 06:07:24 +0000 (06:07 -0000)]
Update VC build files for GAS parser.

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

19 years ago- Add win64 as an alias for -f win32 -m amd64.
Peter Johnson [Wed, 28 Sep 2005 05:50:51 +0000 (05:50 -0000)]
- Add win64 as an alias for -f win32 -m amd64.
- Add elf32 as an alias for -f elf.
- Add elf64 as an alias for -f elf -m amd64.
Note the old command lines still work.

Add a testcase for win64 (includes masm -> yasm mapping, look at
win64-dataref.masm and win64-dataref.asm files respectively).

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

19 years ago* coff-objfmt.c (coff_objfmt_output_expr): Change relocations output for
Peter Johnson [Wed, 28 Sep 2005 03:23:24 +0000 (03:23 -0000)]
* coff-objfmt.c (coff_objfmt_output_expr): Change relocations output for
instructions in Win64 to always be REL32 regardless of whether they're
RIP relative or not.  I don't understand this behavior, but it matches how
ML64 generates relocs and unbreaks linking.  The handling of this case must
be handled at a higher level somehow (either at the linker or the compiler).
Note that this REL32 generation behavior of ML64 happens only with the
latest version (VC8); the 2003 SP1 SDK ML64 doesn't do this.

* bytecode.c (yasm_bc_is_data): New supporting function.
* bytecode.h (yasm_bc_is_data): Prototype.

Testcase pending.

Reported by and much debugging support contributed by:
  Brian Gladman <brg@gladman.plus.com>. Thanks!

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

19 years ago* gas-bison.y: Change instructions and prefixes back into identifiers if
Peter Johnson [Tue, 27 Sep 2005 07:16:17 +0000 (07:16 -0000)]
* gas-bison.y: Change instructions and prefixes back into identifiers if
used as an identifier.
* varinsn.*: Test for this.

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

19 years agoSplit arch module parse_check_id into parse_check_reg, parse_check_reggroup,
Peter Johnson [Tue, 27 Sep 2005 07:07:07 +0000 (07:07 -0000)]
Split arch module parse_check_id into parse_check_reg, parse_check_reggroup,
parse_check_segreg, parse_check_insn, parse_check_prefix, and
parse_check_targetmod.  This will allow for future improvements to
identifier handling in the various parsers.

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

19 years ago* gas-bison.y: Allow .data, .text, and .bss to be used in expressions (they
Peter Johnson [Tue, 27 Sep 2005 03:46:34 +0000 (03:46 -0000)]
* gas-bison.y: Allow .data, .text, and .bss to be used in expressions (they
come through as unique directive tokens, not as DIR_ID).
* dataref-imm.*: Test for this.

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

19 years ago* x86id.re (DEF_INSN_DATA): OR in data[3] rather than setting it directly.
Peter Johnson [Mon, 26 Sep 2005 07:52:25 +0000 (07:52 -0000)]
* x86id.re (DEF_INSN_DATA): OR in data[3] rather than setting it directly.
(yasm_x86__finalize_insn): Ignore special suffix value 0x80 when matching
in info, but use strict matching.  This unbreaks jmp/call broken in previous
commit.
(yasm_x86__parse_check_insn): Initialize data[3] and for FLDT and FSTPT, set
special suffix value 0x80.

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

19 years ago* x86id.re: Implement GAS handling for floating point, some extensions,
Peter Johnson [Mon, 26 Sep 2005 07:06:27 +0000 (07:06 -0000)]
* x86id.re: Implement GAS handling for floating point, some extensions,
interrupts, conditional movs/sets, and a few other minor things.  What's
left: string insns, loop insns, other jmp/call forms, protection control,
SSE/SSE2, and odds and ends (like prefixes-as-instructions).

Add an incomplete FP testcase.

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

19 years ago* x86expr.c (yasm_x86__expr_checkea): Add address16_op parameter to avoid
Peter Johnson [Mon, 26 Sep 2005 04:17:09 +0000 (04:17 -0000)]
* x86expr.c (yasm_x86__expr_checkea): Add address16_op parameter to avoid
errors when using enter in 64-bit mode.
* x86arch.h (yasm_x86__expr_checkea): Update prototype.
* x86bc.c (x86_bc_insn_resolve, x86_bc_insn_tobytes): Pass flag to above.

* x86id.re: Implement mul, imul, div, idiv, enter, leave for GAS mode.
Add tests for above.

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

19 years ago* x86id.re (yasm_x86__parse_check_insn): Implement GAS versions of pushf,
Peter Johnson [Mon, 26 Sep 2005 00:43:28 +0000 (00:43 -0000)]
* x86id.re (yasm_x86__parse_check_insn): Implement GAS versions of pushf,
popf, and conversion instructions (cbw, etc).

Add test case for conversion instructions.

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

19 years ago* x86id.re (yasm_x86__parse_check_insn): Enable lahf/sahf for 64-bit mode,
Peter Johnson [Mon, 26 Sep 2005 00:07:33 +0000 (00:07 -0000)]
* x86id.re (yasm_x86__parse_check_insn): Enable lahf/sahf for 64-bit mode,
as these are supported on newer processor steppings.

Add testcase for lahf/sahf in all BITS modes.

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

19 years ago* x86id.re: For GAS, implement movsx/movzx, pushal, popal, xchg, in, out,
Peter Johnson [Mon, 26 Sep 2005 00:03:02 +0000 (00:03 -0000)]
* x86id.re: For GAS, implement movsx/movzx, pushal, popal, xchg, in, out,
and l*s.

Add tests for in/out and movsx/movzx in GAS mode.

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

19 years agoMove gas_amd64_test.sh to x86_gas64_test.sh to match path.
Peter Johnson [Sun, 25 Sep 2005 20:23:40 +0000 (20:23 -0000)]
Move gas_amd64_test.sh to x86_gas64_test.sh to match path.

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

19 years agoMove parsers/gas/tests/amd64 to arch/x86/tests/gas64, as the tests going
Peter Johnson [Sun, 25 Sep 2005 20:19:05 +0000 (20:19 -0000)]
Move parsers/gas/tests/amd64 to arch/x86/tests/gas64, as the tests going
here are really entirely implemented in the x86 arch.

After this commit, gas_amd64_test.sh needs to be renamed.

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

19 years agoPreliminary GAS parser. Only a few instructions are supported at present.
Peter Johnson [Sun, 25 Sep 2005 04:25:26 +0000 (04:25 -0000)]
Preliminary GAS parser.  Only a few instructions are supported at present.
This work is being done under contract with a company that has requested
to remain unnamed at the present time.

* bc-int.h (yasm_effaddr): Add strong flag to indicate if the effective
address is definitely an effective address; GAS does not use [] to designate
effective addresses so it's otherwise impossible to tell the difference
between "expr(,1)" and just "expr" (important for the relative jump
instructions).
* bytecode.h (yasm_ea_set_strong): New function to set the strong flag.
* bytecode.c (yasm_ea_set_strong): Implementation.
* x86bc.c (yasm_x86__ea_create_reg): Initialize strong flag.

* arch.h (yasm_insn_operand): Add deref flag to indicate use of "*foo" in
GAS syntax.
* arch.c (yasm_operand_create_reg, yasm_operand_create_segreg)
(yasm_operand_create_mem, yasm_operand_create_imm): Set deref flag to 0.

* gas: GAS syntax lexer and parser.  Not all directives are implemented yet
(some will require additional core bytecodes).

* elf-objfmt.c (elf_objfmt_section_switch): Add support for GAS-style
section flags.

* x86arch.h (yasm_arch_x86): Add parser setting.
* x86arch.c (x86_create): Check for gas parser and initialize setting.

* x86bc.c (yasm_x86__ea_create_expr): Transform val+RIP to val wrt RIP when
using the GAS parser (this is how GAS interprets "expr(%rip)").

* x86id.re: Too many changes to enumerate in detail.  Add new modifiers for
GAS suffixes.  Start using them in a couple instructions.  Split check_id
into subfunctions (still one entry point at present).
(yasm_x86__finalize_insn): Support new modifiers, reverse operands, derefs.

* yasm.c (main): Change all undef to extern when using GAS parser (this is
default GAS behavior).

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

19 years ago* arch.h (yasm_arch_reggroup_get_reg): Add macro implementation.
Peter Johnson [Sun, 25 Sep 2005 03:47:13 +0000 (03:47 -0000)]
* arch.h (yasm_arch_reggroup_get_reg): Add macro implementation.

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

19 years ago* genmodule.c (main): Make sure len is initialized to 0.
Peter Johnson [Sun, 25 Sep 2005 03:35:49 +0000 (03:35 -0000)]
* genmodule.c (main): Make sure len is initialized to 0.

* genmodule.vcproj: Ensure FILTERMODE is defined for Debug configuration.

Patch by: Masaru Tsuchiyama <tsuchiyama@asahi-net.email.ne.jp>

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

19 years ago* basic-optimizer.c (basic_optimize_bytecode_2): Fix check of
Peter Johnson [Sun, 25 Sep 2005 03:27:05 +0000 (03:27 -0000)]
* basic-optimizer.c (basic_optimize_bytecode_2): Fix check of
yasm_bc_resolve() return value (it's a flag, not a signed integer).

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

19 years ago* bytecode.h (yasm_dv_create_float): Remove (no implementation exists or is
Peter Johnson [Sun, 25 Sep 2005 03:23:54 +0000 (03:23 -0000)]
* bytecode.h (yasm_dv_create_float): Remove (no implementation exists or is
planned).

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

19 years ago* arch.h (yasm_arch_check_id_retval): Add YASM_ARCH_CHECK_ID_REGGROUP to
Peter Johnson [Sun, 25 Sep 2005 03:20:54 +0000 (03:20 -0000)]
* arch.h (yasm_arch_check_id_retval): Add YASM_ARCH_CHECK_ID_REGGROUP to
represent a register group (e.g. indexed registers).
(yasm_arch_reggroup_get_reg): New function to get a specific register from
a register group and index.
(yasm_arch_module): Add module version of yasm_arch_reggroup_get_reg().

* lc3barch.c (lc3b_reggroup_get_reg): Implement.
(yasm_lc3b_LTX_arch): Point to implementation.
* x86arch.c (x86_reggroup_get_reg, yasm_x86_LTX_arch): Likewise.

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

19 years ago* symrec.c (symtab_parser_finalize_checksym): Remove cruft that snuck into
Peter Johnson [Sun, 25 Sep 2005 01:06:00 +0000 (01:06 -0000)]
* symrec.c (symtab_parser_finalize_checksym): Remove cruft that snuck into
previous commit.

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

19 years ago* symrec.h (yasm_symtab_parser_finalize): Add function to declare all
Peter Johnson [Sun, 25 Sep 2005 01:01:02 +0000 (01:01 -0000)]
* symrec.h (yasm_symtab_parser_finalize): Add function to declare all
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

19 years ago* coretype.h (yasm_expr_op): Add YASM_EXPR_NOR for NOR operator.
Peter Johnson [Sun, 25 Sep 2005 00:47:35 +0000 (00:47 -0000)]
* coretype.h (yasm_expr_op): Add YASM_EXPR_NOR for NOR operator.

* intnum.c (yasm_intnum_calc): Handle YASM_EXPR_NOR.
* expr.c (yasm_expr_print): Likewise.

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

19 years ago* arch.h (yasm_arch_syntax_flavor): Remove.
Peter Johnson [Sun, 25 Sep 2005 00:41:04 +0000 (00:41 -0000)]
* arch.h (yasm_arch_syntax_flavor): Remove.
(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

19 years ago* x86bc.c (x86_bc_insn_resolve): When handling shift_op, change immlen
Peter Johnson [Sun, 25 Sep 2005 00:15:17 +0000 (00:15 -0000)]
* x86bc.c (x86_bc_insn_resolve): When handling shift_op, change immlen
rather than munging bc->len directly.

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

19 years ago* yasm.c (main): Add workaround for when -m amd64 is specified to override
Peter Johnson [Sun, 25 Sep 2005 00:09:30 +0000 (00:09 -0000)]
* yasm.c (main): Add workaround for when -m amd64 is specified to override
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

19 years ago* x86bc.c (x86_bc_insn_resolve): Actually support the flag to allow
Peter Johnson [Sat, 24 Sep 2005 23:50:09 +0000 (23:50 -0000)]
* x86bc.c (x86_bc_insn_resolve): Actually support the flag to allow
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

19 years ago* elf-objfmt.c (elf_objfmt_output_section): Don't try to skip empty
Peter Johnson [Thu, 8 Sep 2005 05:01:32 +0000 (05:01 -0000)]
* elf-objfmt.c (elf_objfmt_output_section): Don't try to skip empty
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

19 years agoFix VC build files.
Peter Johnson [Thu, 8 Sep 2005 02:00:08 +0000 (02:00 -0000)]
Fix VC build files.
 - _stdint.h for VC build (both 64-bit and 32-bit)
 - Handle spaces in genmodule/genmacro/re2c paths.

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

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