Shifting labels in constants

Alan Modra amodra@bigpond.net.au
Fri May 10 05:45:00 GMT 2002


On Fri, May 10, 2002 at 01:30:07PM +0300, Raul Hudea wrote:
> .section .text
> .align 16
> .L1:
>         .long ((.L2) >> 1 )
> .L2:
>     nop
> 
> but I keep getting the following error:
> Error: invalid section for operation

The error message could be improved.  You're asking the assembler
to generate a relocatable object file containing information (a
relocation) that says you want a the value of some offset in the
.text section shifted right once.  Typical object formats can't
represent such expressions.  You can only use the shift right
operator on symbols from the absolute section (that's what the
error message is saying) or expressions that resolve to a number.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list