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: Help about calculation of addend for ELF relocations for MIPS arch


"Pan ruochen" <panruochen@gmail.com> writes:

> Does this mean the addend is saved in the storage location where relocation
> will be applied to ? For example, for a R_MIPS_26 relocation entry, the addend
> is saved in the `targ26' field.

Yes.

> Let's deduce back from the final results. The relocation entry is at
> the offset 0x18,
> and of the type `R_MIPS_26'. The symbol is not local, so the foluma
> (sign-extend(A<<2) + S) >> 2
> should be applied. And S will be the value of the symbol `entry',
> which is 0x2e8.

No.  In the reloc computation, S is the value of the symbol in the
fully linked executable, not the value in the object file.  In this
case I imagine that S is 0x188e12e8.

Ian


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