* splitpath.c (yasm__splitpath_unix, yasm__splitpath_win): New.
* coretype.h: Prototype above and alias yasm__splitpath.
* splitpath_test.c: New test for above.
svn path=/trunk/yasm/; revision=1345
.local sym; .comm sym; rather than directly using .lcomm sym. Handle this
usage as well. While we're here, also implement alignment for .lcomm and
refactor .lcomm handling and alignment handling.
* gas-token.re: Recognize .local.
* gas-bison.y (DIR_LOCAL): Implement .local.
(DIR_COMM): Recognize .local ; .comm case and call define_lcomm().
(DIR_LCOMM): Move functionality into..
(define_lcomm): Here, and implement alignment with..
(gas_parser_align): That now takes raw exprs. The valparam part of that is
now implemented in..
(gas_parser_dir_align): Formerly gas_parser_align.
(DIR_ALIGN): Use gas_parser_dir_align() instead.
* symrec.c (yasm_symtab_get): New function to just get a symbol based on name
without actually "referencing" it.
* symrec.h (yasm_symtab_get): Prototype.
* coretype.h (yasm_sym_vis): Add YASM_SYM_DLOCAL for flagging that a symbol
is explicitly flagged as a local symbol (rather than just default that way).
svn path=/trunk/yasm/; revision=1340
the __YASM_OBJFMT__ value to always be lowercase, e.g. for "-f Win32" on
the command line, __YASM_OBJFMT__ becomes "win32".
Requested by: Brian Gladman <brg@gladman.plus.com>
svn path=/trunk/yasm/; revision=1337
Works for native Win32 builds, Win32->x64 cross builds, and native x64 builds.
Submitted by: Brian Gladman <brg@gladman.plus.com>
svn path=/trunk/yasm/; revision=1334
formats). This makes integration with the VC8 build tools much nicer, as
VC8 uses "x64" as the PlatformName environment setting.
* win64/Makefile.inc, Mkfiles/Makefile.flat, Mkfiles/Makefile.dj: Update
build files to look for objfmt_x64 module.
Suggested by: Brian Gladman <brg@gladman.plus.com>
svn path=/trunk/yasm/; revision=1331
unsigned char. This was causing relocation corruption after 255 symbols,
in ELF32 only.
* elfmanysym.asm: Additional test that has exactly 257 symbols.
We actually should have caught this with the very large 32-bit elf-x86id.asm
test, but that object file (unlike the 64-bit GAS version of it) has only
been manually reviewed. This bug was only in ELF32, and wasn't in ELF64.
Fixes bug #62 submitted by: Jens von der Heydt <mailme@vdh-webservice.de>
svn path=/trunk/yasm/; revision=1330
* Mkfiles/vc8/config.h: Define _CRT_SECURE_NO_DEPRECATE to avoid most warnings about *_s functions.
Also use _stricmp directly instead of stricmp to avoid warnings.
* libyasm/strcasecmp.c: Support _stricmp usage.
* util.h: Likewise.
* tools/re2c/actions.c: Include ctype.h to define toupper/tolower.
* Mkfiles/vc8/modules/modules.vcproj: Don't include nasm-macros.c directly; this file is included
into another file and has no public variables.
* Mkfiles/vc8/yasm.sln: Allow x64 cross-builds from Win32 by building genmacro, genmodule, and
re2c for Win32 target.
svn path=/trunk/yasm/; revision=1328
Contributed by: Brian Gladman <brg@gladman.plus.com>
Also added a couple VC7 build files that were in the tree but missing from
EXTRA_DIST (and thus not included in the distribution).
svn path=/trunk/yasm/; revision=1326
__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
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
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
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
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
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
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
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
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
"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
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
* 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
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
* 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
* 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