bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug gas/37] New: [intel_syntax] can't reference global symbols havi


From: Nick Clifton
Subject: Re: [Bug gas/37] New: [intel_syntax] can't reference global symbols having certain names
Date: Mon, 08 Mar 2004 11:18:12 +0000
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.2 (gnu/linux)

Hi Brian, Hi Diego,

> The errors I get are typically as follows:
>> ./gas/as-new /tmp/foo.s
> /tmp/foo.s: Assembler messages:
> /tmp/foo.s:7: Error: missing or invalid immediate expression `' taken as 0
> /tmp/foo.s:7: Error: suffix or operands invalid for `mov'
> /tmp/foo.s:8: Error: missing or invalid immediate expression `' taken as 0
> /tmp/foo.s:8: Error: suffix or operands invalid for `call'
>
> Here is the code: All it tries to do is call and take the address of a 
> function
> called "byte". 
>
>> cat /tmp/foo.s
> .intel_syntax
> .text
> byte:
>         RET
>
> foo:
>         MOV EAX, OFFSET byte
>         CALL byte
>         RET
> ------------------
>
> You can get similar bad behavior by replacing byte with
> any of: (word dword xword offset mov ret call).


I am not sure if it is possible to always distinguish between the use
of keywords as Intel syntax tokens and as symbol names.

The patch below will allow your test case to compile and also issue a
suitable warning message, but I am deferring to Diego Novillo, the x86
Intel Syntax maintainer as to whether this patch is suitable to
applied to the sources.

Cheers
        Nick

gas/ChangeLog
2004-03-08  Nick Clifton  <address@hidden>

        * config/tc-i386.c (intel_get_token): If the token also
          matches a defined symbol, prefer the defined symbol.

Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.149
diff -c -3 -p -r1.149 tc-i386.c
*** gas/config/tc-i386.c        22 Nov 2003 02:35:30 -0000      1.149
--- gas/config/tc-i386.c        8 Mar 2004 11:14:20 -0000
*************** intel_get_token ()
*** 6174,6179 ****
--- 6174,6188 ----
  
          else
            new_token.code = T_ID;
+ 
+         if (new_token.code != T_ID
+             && symbol_find (new_token.str)
+             && S_IS_DEFINED (symbol_find (new_token.str)))
+           {
+             as_warn (_("Assuming the use of '%s' referes to the"), 
new_token.str);
+             as_warn (_(" defined symbol and not the Intel syntax token"));
+             new_token.code = T_ID;
+           }
        }
      }
  
        





reply via email to

[Prev in Thread] Current Thread [Next in Thread]