From 4003fa1bc0c69cf7cc08119b7452e3b8c68829cb Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 8 Apr 2010 06:10:16 +0000 Subject: Update frontend --version copyright dates. svn path=/trunk/yasm/; revision=2317 --- frontends/tasm/tasm.c | 2 +- frontends/yasm/yasm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontends/tasm/tasm.c b/frontends/tasm/tasm.c index 70f9573a..400e1baf 100644 --- a/frontends/tasm/tasm.c +++ b/frontends/tasm/tasm.c @@ -226,7 +226,7 @@ static opt_option options[] = /*@observer@*/ static const char *version_msg[] = { PACKAGE_NAME " " PACKAGE_INTVER "." PACKAGE_BUILD, "Compiled on " __DATE__ ".", - "Copyright (c) 2001-2008 Peter Johnson and other Yasm developers.", + "Copyright (c) 2001-2010 Peter Johnson and other Yasm developers.", "Run yasm --license for licensing overview and summary." }; diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c index 05d0dfe7..ca049756 100644 --- a/frontends/yasm/yasm.c +++ b/frontends/yasm/yasm.c @@ -215,7 +215,7 @@ static opt_option options[] = /*@observer@*/ static const char *version_msg[] = { PACKAGE_NAME " " PACKAGE_INTVER "." PACKAGE_BUILD, "Compiled on " __DATE__ ".", - "Copyright (c) 2001-2008 Peter Johnson and other Yasm developers.", + "Copyright (c) 2001-2010 Peter Johnson and other Yasm developers.", "Run yasm --license for licensing overview and summary." }; -- cgit v1.2.1 From d5ae19570398116de4d7c31d1a72de771715c138 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 15 May 2010 07:45:48 +0000 Subject: Fix #202 (incorrect GOT offset generated in NASM mode). Don't generate an additional offset for _GLOBAL_OFFSET_TABLE_ if a WRT was specified (the NASM usage). In GAS, _GLOBAL_OFFSET_TABLE_ doesn't have a WRT but instead has special handling. This isn't quite *exactly* the right fix; a better fix would be to recognize the _GLOBAL_OFFSET_TABLE_ case in the GAS parser and adjust the value appropriately there. However, this fix seems to do the right thing in the meantime for both GAS and NASM cases. svn path=/trunk/yasm/; revision=2321 --- modules/objfmts/elf/elf-x86-x86.c | 13 +------------ modules/objfmts/elf/tests/elfso.hex | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/modules/objfmts/elf/elf-x86-x86.c b/modules/objfmts/elf/elf-x86-x86.c index d2fa6d1e..3c5157fe 100644 --- a/modules/objfmts/elf/elf-x86-x86.c +++ b/modules/objfmts/elf/elf-x86-x86.c @@ -140,18 +140,7 @@ elf_x86_x86_handle_reloc_addend(yasm_intnum *intn, elf_reloc_entry *reloc, unsigned long offset) { - int is_GOT = reloc->is_GOT_sym; - - if (reloc->wrt) { - const elf_machine_ssym *ssym = (elf_machine_ssym *) - yasm_symrec_get_data(reloc->wrt, &elf_ssym_symrec_data); - if (!ssym || reloc->valsize != ssym->size) - yasm_internal_error(N_("Unsupported WRT")); - if (ssym->reloc == R_386_GOTPC) - is_GOT = 1; - } - - if (is_GOT && reloc->valsize == 32 && offset != 0) + if (!reloc->wrt && reloc->is_GOT_sym && reloc->valsize == 32 && offset != 0) { yasm_intnum *off_intn = yasm_intnum_create_uint(offset); yasm_intnum_calc(intn, YASM_EXPR_ADD, off_intn); diff --git a/modules/objfmts/elf/tests/elfso.hex b/modules/objfmts/elf/tests/elfso.hex index 94a50cbd..206cce9c 100644 --- a/modules/objfmts/elf/tests/elfso.hex +++ b/modules/objfmts/elf/tests/elfso.hex @@ -88,7 +88,7 @@ e8 5b 81 c3 -05 +03 00 00 00 -- cgit v1.2.1 From 6c7cc8ef767ff45a3a6fb215ff27568a55f0897b Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 16 May 2010 03:14:09 +0000 Subject: Support all unary operators in directive expressions. svn path=/trunk/yasm/; revision=2322 --- modules/parsers/nasm/nasm-parse.c | 67 +++++++++++++-------------------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/modules/parsers/nasm/nasm-parse.c b/modules/parsers/nasm/nasm-parse.c index 0c4820ff..792091e1 100644 --- a/modules/parsers/nasm/nasm-parse.c +++ b/modules/parsers/nasm/nasm-parse.c @@ -1321,47 +1321,7 @@ parse_expr6(yasm_parser_nasm *parser_nasm, expr_type type) yasm_expr *e; yasm_symrec *sym; - /* directives allow very little and handle IDs specially */ - if (type == DIR_EXPR) { - switch (curtok) { - case '~': - get_next_token(); - e = parse_expr6(parser_nasm, type); - if (!e) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expected expression after %s"), "`~'"); - return NULL; - } - return p_expr_new_branch(YASM_EXPR_NOT, e); - case '(': - get_next_token(); - e = parse_expr(parser_nasm, type); - if (!e) { - yasm_error_set(YASM_ERROR_SYNTAX, - N_("expected expression after %s"), "`('"); - return NULL; - } - if (!expect(')')) { - yasm_error_set(YASM_ERROR_SYNTAX, N_("missing parenthesis")); - return NULL; - } - get_next_token(); - return e; - case INTNUM: - e = p_expr_new_ident(yasm_expr_int(INTNUM_val)); - break; - case REG: - e = p_expr_new_ident(yasm_expr_reg(REG_val)); - break; - case ID: - sym = yasm_symtab_use(p_symtab, ID_val, cur_line); - e = p_expr_new_ident(yasm_expr_sym(sym)); - yasm_xfree(ID_val); - break; - default: - return NULL; - } - } else switch (curtok) { + switch (curtok) { case '+': get_next_token(); e = parse_expr6(parser_nasm, type); @@ -1437,10 +1397,8 @@ parse_expr6(yasm_parser_nasm *parser_nasm, expr_type type) return e; case INTNUM: e = p_expr_new_ident(yasm_expr_int(INTNUM_val)); - break; - case FLTNUM: - e = p_expr_new_ident(yasm_expr_float(FLTNUM_val)); - break; + get_next_token(); + return e; case REG: if (type == DV_EXPR) { yasm_error_set(YASM_ERROR_SYNTAX, @@ -1448,6 +1406,24 @@ parse_expr6(yasm_parser_nasm *parser_nasm, expr_type type) return NULL; } e = p_expr_new_ident(yasm_expr_reg(REG_val)); + get_next_token(); + return e; + } + + /* directives allow very little and handle IDs specially */ + if (type == DIR_EXPR) { + switch (curtok) { + case ID: + sym = yasm_symtab_use(p_symtab, ID_val, cur_line); + e = p_expr_new_ident(yasm_expr_sym(sym)); + yasm_xfree(ID_val); + break; + default: + return NULL; + } + } else switch (curtok) { + case FLTNUM: + e = p_expr_new_ident(yasm_expr_float(FLTNUM_val)); break; case STRING: { @@ -1498,6 +1474,7 @@ parse_expr6(yasm_parser_nasm *parser_nasm, expr_type type) default: return NULL; } + get_next_token(); return e; } -- cgit v1.2.1 From 104dba1981b5df6363aa69fe3da5cae83b481a30 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 16 May 2010 03:37:00 +0000 Subject: Fix #201: explicitly ignore [warning] directive and treat as warning. svn path=/trunk/yasm/; revision=2323 --- modules/parsers/nasm/nasm-parse.c | 16 ++++++++++++++++ modules/parsers/nasm/tests/Makefile.inc | 3 +++ modules/parsers/nasm/tests/dirwarning.asm | 1 + modules/parsers/nasm/tests/dirwarning.errwarn | 1 + modules/parsers/nasm/tests/dirwarning.hex | 0 5 files changed, 21 insertions(+) create mode 100644 modules/parsers/nasm/tests/dirwarning.asm create mode 100644 modules/parsers/nasm/tests/dirwarning.errwarn create mode 100644 modules/parsers/nasm/tests/dirwarning.hex diff --git a/modules/parsers/nasm/nasm-parse.c b/modules/parsers/nasm/nasm-parse.c index 792091e1..8cbbe531 100644 --- a/modules/parsers/nasm/nasm-parse.c +++ b/modules/parsers/nasm/nasm-parse.c @@ -339,6 +339,22 @@ parse_line(yasm_parser_nasm *parser_nasm) dirname = DIRECTIVE_NAME_val; get_next_token(); + /* ignore [warning]. TODO: actually implement */ + if (yasm__strcasecmp(dirname, "warning") == 0) { + yasm_warn_set(YASM_WARN_GENERAL, + N_("[warning] directive not supported; ignored")); + + /* throw away the rest of the directive tokens */ + while (!is_eol() && curtok != ']') + { + destroy_curtok(); + get_next_token(); + } + expect(']'); + get_next_token(); + return NULL; + } + if (curtok == ']' || curtok == ':') have_vps = 0; else if (!parse_directive_valparams(parser_nasm, &dir_vps)) { diff --git a/modules/parsers/nasm/tests/Makefile.inc b/modules/parsers/nasm/tests/Makefile.inc index 9a1d5db5..ddf5910b 100644 --- a/modules/parsers/nasm/tests/Makefile.inc +++ b/modules/parsers/nasm/tests/Makefile.inc @@ -9,6 +9,9 @@ EXTRA_DIST += modules/parsers/nasm/tests/alignnop32.asm EXTRA_DIST += modules/parsers/nasm/tests/alignnop32.hex EXTRA_DIST += modules/parsers/nasm/tests/charconstmath.asm EXTRA_DIST += modules/parsers/nasm/tests/charconstmath.hex +EXTRA_DIST += modules/parsers/nasm/tests/dirwarning.asm +EXTRA_DIST += modules/parsers/nasm/tests/dirwarning.errwarn +EXTRA_DIST += modules/parsers/nasm/tests/dirwarning.hex EXTRA_DIST += modules/parsers/nasm/tests/dy.asm EXTRA_DIST += modules/parsers/nasm/tests/dy.hex EXTRA_DIST += modules/parsers/nasm/tests/endcomma.asm diff --git a/modules/parsers/nasm/tests/dirwarning.asm b/modules/parsers/nasm/tests/dirwarning.asm new file mode 100644 index 00000000..265d60a5 --- /dev/null +++ b/modules/parsers/nasm/tests/dirwarning.asm @@ -0,0 +1 @@ +[warning -w] diff --git a/modules/parsers/nasm/tests/dirwarning.errwarn b/modules/parsers/nasm/tests/dirwarning.errwarn new file mode 100644 index 00000000..366c8d66 --- /dev/null +++ b/modules/parsers/nasm/tests/dirwarning.errwarn @@ -0,0 +1 @@ +-:1: warning: [warning] directive not supported; ignored diff --git a/modules/parsers/nasm/tests/dirwarning.hex b/modules/parsers/nasm/tests/dirwarning.hex new file mode 100644 index 00000000..e69de29b -- cgit v1.2.1