This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: MIPS assembly error
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: jbaker at qnx dot com
- Cc: binutils at sources dot redhat dot com
- Date: 15 Jul 2004 22:52:30 -0400
- Subject: Re: MIPS assembly error
- References: <40F43F73.6060801@qnx.com>
Jeff Baker <jbaker@qnx.com> writes:
> I posted this question a while ago and didn't receive a response from
> the list, so I'll try again.
>
> Assemble the following code for MIPS (binutils 2.15.91):
> ===================================
> .data
> actives: .word 0
> ker_stack: .word 0
>
> .equ distance,(ker_stack-actives)
>
> testloc: .word distance
>
> .text
> li $4,distance
> ===================================
>
> And you get:
>
> main.s: Assembler messages:
> main.s:10: Error: absolute expression required `li'
>
> Is this a bug in gas?
Unclear.
It is probably possible to make this work. It may not be trivial.
There are very similar cases which would be very very hard to
implement correctly.
The basic problem is that "li" is not an instruction, it is a macro
which expands to different instruction sequences depending on the
second operand. To make this simple, it currently requires an
expression which can be fully evaluated at the time the instruction is
seen. In the above example, gas does have enough information when the
instruction is seen to evaluate the operand, at least in principle.
But minor changes to the example would make it impossible for gas to
determine the operand value at the time that it parses the
instruction, and handling that correctly would be very very hard.
A better answer would refer to some sort of specification of MIPS
assembly language and determine whether li is permitted to use
anything other than simple constants. However, I do not know of any
such specification.
Ian