This is the mail archive of the binutils@sourceware.org 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: Problem with pcrel relocs and addends


"Will Newton" <will.newton@imgtec.com> writes:

> An example:
>
> .text
>         .global __func1
>         .type __func1,function
> __func1:
>     CALLR D1RtP,__func2
>
>         .global __func2
>         .type __func2,function
> __func2:
>     CALLR D1RtP,__func1
>
> Objdump -r:
>
> RELOCATION RECORDS FOR [.text]:
> OFFSET   TYPE              VALUE
> 00000000 R_META_RELBRANCH  __func2
> 00000004 R_META_RELBRANCH  __func1+0xfffffffc

That appears to be correct, as long as the offset that the CALLR insn
expects is relative to the value of the PC after the insn.  If you put
something between the first CALLR and the __func2 label you should see the
first addend to increase and the second addend to decrease by the same
amount.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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