This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Help about calculation of addend for ELF relocations for MIPS arch
- From: Ian Lance Taylor <iant at google dot com>
- To: "Pan ruochen" <panruochen at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 12 Aug 2008 07:07:57 -0700
- Subject: Re: Help about calculation of addend for ELF relocations for MIPS arch
- References: <af0faace0808120100u29bf6dafn56265246f93324b8@mail.gmail.com>
"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