Re: Help about 'addend' of The ELF specification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PRC wrote:

> I'm studying the ELF specfication version 1.1 recently. I'm confused about the 'addend' which is used in relocation. There doesn't seems to be explict descriptions about 'addend' in the specification. Can somebody make detailed explainations about how to calculate the value of the 'addend' when relocating an executable.

It looks like you're only looking at the generic ABI spec.  You need to
also look at the processor-specific suppliment for whatever platform
you're interested in (psABI).  In it, the relocation types for that
specific architecture will be defined, each with its own formula that
may or may not include the addend.

For example look at figure 4-4 of the i386 psABI:

Name           Value  Field   Calculation
-------------------------------------------
R_386_NONE     0      none    none
R_386_32       1      word32  S + A
R_386_PC32     2      word32  S + A - P
R_386_GOT32    3      word32  G + A - P
R_386_PLT32    4      word32  L + A - P
R_386_COPY     5      none    none
R_386_GLOB_DAT 6      word32  S
R_386_JMP_SLOT 7      word32  S
R_386_RELATIVE 8      word32  B + A
R_386_GOTOFF   9      word32  S + A - GOT
R_386_GOTPC    10     word32  GOT + A - P

(A is the addend value)

Each architecture defines its own set of R_<arch> relocations, each with
its own definition, so you can't really deduce anything from the generic
spec.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux