Shifting labels in constants

Raul Hudea rhudea@develop4all.com
Fri May 10 06:37:00 GMT 2002


Thanks for your answer,

But even if I replace .text with .absolute in the small program that I
wrote, I get the same error.

I am a little puzzled because if I have
    .long (.L2 + 1) it works, but if I use
    .long (.L2 >> 1) it does not work. 
To me the two expressions look like arithmetic expressions, but one
works and the other don't.When is replaced the value of .L2 in the first
expression and when, in the second case?

Raul.


On Fri, 2002-05-10 at 15:45, Alan Modra wrote:
> 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