GCC assembler bug

H. J. Lu hjl@lucon.org
Sat Apr 26 04:30:00 GMT 2003


On Sat, Apr 26, 2003 at 01:32:03AM +0200, Piotr Wyderski wrote:
> Hello,
> 
> it seems there's a bug in the GCC assembler. The ".equ"
> directive can be used to define an address of a function:
> 
>     .equ FN,myfunction1
>     call FN
> 
> If there are multiple and different definitions of FN, like this:
> 
>     .equ FN,myfunction1
>     call FN
> 
>     .equ FN,myfunction2
>     call FN
> 
> then only the first one is used and GCC generates
> 
>     call myfunction1
>     call myfunction1
> 
> instead of 
> 
>     call myfunction1
>     call myfunction2
> 
> I use the version 3.2 and the host computer is i386@Linux.
> 

I believe this behavior is documented in gas manual. However, Intel
ia64 assembler supports "=" and "==" which works similar to above.
You can think

	foo=bar
	foo==bar

as

#undef foo
#define foo bar

where bar can be anything. They won't affect symbol table. The only
difference between "=" and "==" is "==" can only be used once in a
translation unit. I was wondering how hard to add this feature to gas.
Any ideas?


H.J.



More information about the Gcc mailing list