From 6588847e4f855188fcd187e6484791dffc350469 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Sun, 15 Oct 2000 06:17:36 +0000 Subject: [PATCH] gas: 2000-10-15 Diego Novillo * config/tc-i386.c (i386_operand_modifier): Only match modifiers SHORT and FLAT if they are followed by a space. (parse_register): When `allow_naked_reg' is set, do not confuse identifiers that start with a register name with a register. gas/testsuite: 2000-10-15 Diego Novillo * intel.s, intel.d: Add new tests for naked registers using intel syntax. --- gas/ChangeLog | 7 +++++++ gas/config/tc-i386.c | 14 ++++++++++++-- gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/i386/intel.d | 10 ++++++++++ gas/testsuite/gas/i386/intel.s | 10 ++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 7bbaff072a2..59dd1a86b80 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2000-10-15 Diego Novillo + + * config/tc-i386.c (i386_operand_modifier): Only match + modifiers SHORT and FLAT if they are followed by a space. + (parse_register): When `allow_naked_reg' is set, do not confuse + identifiers that start with a register name with a register. + 2000-10-12 Kazu Hirata * app.c: Fix formatting. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 31e6bfaed06..83c1e7b8783 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3026,7 +3026,9 @@ i386_operand_modifier (op_string, got_a_float) return XWORD_PTR; } - else if (!strncasecmp (*op_string, "SHORT", 5)) + /* Compare with space separator to avoid confusing identifier `short_var' + with attribute `short'. */ + else if (!strncasecmp (*op_string, "SHORT ", 6)) { *op_string += 5; return SHORT; @@ -3038,7 +3040,9 @@ i386_operand_modifier (op_string, got_a_float) return OFFSET_FLAT; } - else if (!strncasecmp (*op_string, "FLAT", 4)) + /* Compare with space separator to avoid confusing identifier `flat_var' + with attribute `flat'. */ + else if (!strncasecmp (*op_string, "FLAT ", 5)) { *op_string += 4; return FLAT; @@ -4235,6 +4239,12 @@ parse_register (reg_string, end_op) s++; } + /* For naked regs, make sure that we are not dealing with an identifier. + This prevents confusing an identifier like `eax_var' with register + `eax'. */ + if (allow_naked_reg && identifier_chars[(unsigned char) *s]) + return (const reg_entry *) NULL; + *end_op = s; r = (const reg_entry *) hash_find (reg_hash, reg_name_given); diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 09675f7581c..307776b2c31 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2000-10-15 Diego Novillo + + * intel.s, intel.d: Add new tests for naked registers using intel + syntax. + 2000-09-29 Hans-Peter Nilsson * gas/cris/regprefix-err-1.s, gas/cris/rd-regprefix-1.s, diff --git a/gas/testsuite/gas/i386/intel.d b/gas/testsuite/gas/i386/intel.d index 76f0f8ab9b8..487ab4e2751 100644 --- a/gas/testsuite/gas/i386/intel.d +++ b/gas/testsuite/gas/i386/intel.d @@ -572,3 +572,13 @@ Disassembly of section .text: 9b8: 66 0f bd 90 90 90 90 90 [ ]*bsr 0x90909090\(%eax\),%dx 9c0: 66 0f be 90 90 90 90 90 [ ]*movsbw 0x90909090\(%eax\),%dx 9c8: 66 0f c1 90 90 90 90 90 [ ]*xadd %dx,0x90909090\(%eax\) + +000009d0 : + 9d0: c3 [ ]*ret + +000009d1 : + 9d1: c3 [ ]*ret + +000009d2 : + 9d2: e8 f9 ff ff ff [ ]*call 9d0 + 9d7: e8 f5 ff ff ff [ ]*call 9d1 diff --git a/gas/testsuite/gas/i386/intel.s b/gas/testsuite/gas/i386/intel.s index ab41dbf260d..99bcf479240 100644 --- a/gas/testsuite/gas/i386/intel.s +++ b/gas/testsuite/gas/i386/intel.s @@ -566,3 +566,13 @@ foo: bsr dx, 0x90909090[eax] movsx dx, byte ptr 0x90909090[eax] xadd 0x90909090[eax], dx + +gs_foo: + ret + +short_foo: + ret + +bar: + call gs_foo + call short_foo -- 2.30.2