Wow. It might help to mention this in libelf somewhere.
http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-June/050697.html
Most architectures have the following 64 bit relocation record format:
typedef struct
{
Elf64_Addrr_offset; /* Address of reference */
Elf64_Xword r_info; /* Symbol index and type of relocation */
} Elf64_Rel;
typedef struct
{
Elf64_Addr r_offset;
Elf64_Xwordr_info;
Elf64_Sxword r_addend;
} Elf64_Rela;
Whereas N64 has the following format:
typedef struct
{
Elf64_Addrr_offset; /* Address of reference */
Elf64_Word r_sym; /* Symbol index */
Elf64_Byte r_ssym;/* Special symbol */
Elf64_Byte r_type3; /* Relocation type */
Elf64_Byte r_type2; /* Relocation type */
Elf64_Byte r_type; /* Relocation type */
} Elf64_Rel;
typedef struct
{
Elf64_Addrr_offset; /* Address of reference */
Elf64_Word r_sym; /* Symbol index */
Elf64_Byte r_ssym;/* Special symbol */
Elf64_Byte r_type3; /* Relocation type */
Elf64_Byte r_type2; /* Relocation type */
Elf64_Byte r_type; /* Relocation type */
Elf64_Sxword r_addend;
} Elf64_Rela;
On Thu, Jul 10, 2014 at 10:04 PM, Daniel Wilkerson
wrote:
> If I have a Elf64_Rela and I call ELF64_R_SYM on its r_info field,
> what is the meaning of the number that I get back? I'm getting
> numbers too large to be an index into a symbol table.
>
> Daniel
>
> Elf64_Rela const rela = ...;
> // from elftoolchain/common/elfdefinitions.h:
> // typedef struct {
> // Elf64_Addr r_offset;/* location to apply relocation to */
> // Elf64_Xword r_info; /* type+section for relocation */
> // Elf64_Sxword r_addend;/* constant addend */
> // } Elf64_Rela;
> int const sym = ELF64_R_SYM(rela.r_info);
--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
Elftoolchain-developers mailing list
Elftoolchain-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/elftoolchain-developers