4.2 Create Relocation Information

The following code creates a piece of relocation information.

struct expression *exp;
Elf32_Rela *rela;

if (exp->exp_type == SYM)
{
  symbol_value = Table_get (symbol_table, exp->u.sym);
  [allocate memory for rela]
  rela->r_offset = location_counter;
  rela->r_info = ELF32_R_INFO (symbol_value->st_other, r_sparc_type);
  rela->r_addend = 0;
}

table of content