This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ld-2.12.1, PowerPC


On Fri, Oct 11, 2002 at 11:50:30AM +0200, Etienne Lorrain wrote:
> $ local/bin/xas -m603 -al -o a.o
>         li      %r0,0
>         a_label:
>         subi    %r3,%r3,a_label@l
[snip]
> Disassembly of section .text:
> 
> 01800074 <a_label-0x4>:
>  1800074:       38 00 00 00     li      r0,0
> 
> 01800078 <a_label>:
>  1800078:       38 63 00 78     addi    r3,r3,120
> ----------------------
> 
>   Everything is right, but why the subi has been changed by xld to addi ?

Well, there isn't a powerpc subi instruction at the machine level.
subi is really a macro, with "subi Rx,Ry,value" equivalent to
"addi Rx,Ry,-value".

>  It could have been "addi r3,r3,0xFF88", but it is not (-120 = 0xFF88).

gas should have rejected your source, as it's not possible in
general to use the negative of a (non-absolute) label.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]