Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
elf-hppa.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ELF_HOWTO_TABLE_SIZE   R_PARISC_UNIMPLEMENTED + 1
#define OFFSET_14R_FROM_21L   4
#define OFFSET_14F_FROM_21L   5

Functions

elf_hppa_reloc_type elf_hppa_reloc_final_type (bfd *abfd, elf_hppa_reloc_type base_type, int format, unsigned int field)
elf_hppa_reloc_type ** _bfd_elf_hppa_gen_reloc_type (bfd *abfd, elf_hppa_reloc_type base_type, int format, unsigned int field, int ignore ATTRIBUTE_UNUSED, asymbol *sym ATTRIBUTE_UNUSED)
static void elf_hppa_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc, Elf_Internal_Rela *elf_reloc)
static void elf_hppa_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc, Elf_Internal_Rela *elf_reloc)
static reloc_howto_type * elf_hppa_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
static reloc_howto_type * elf_hppa_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
static bfd_boolean elf_hppa_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
static bfd_boolean elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
static void elf_hppa_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
static int hppa_unwind_entry_compare (const void *a, const void *b)
static bfd_boolean elf_hppa_sort_unwind (bfd *abfd)
static unsigned int elf_hppa_action_discarded (asection *sec)

Variables

static reloc_howto_type elf_hppa_howto_table [ELF_HOWTO_TABLE_SIZE]

Define Documentation

#define ELF_HOWTO_TABLE_SIZE   R_PARISC_UNIMPLEMENTED + 1

Definition at line 21 of file elf-hppa.h.

#define OFFSET_14F_FROM_21L   5

Definition at line 578 of file elf-hppa.h.

#define OFFSET_14R_FROM_21L   4

Definition at line 577 of file elf-hppa.h.


Function Documentation

elf_hppa_reloc_type** _bfd_elf_hppa_gen_reloc_type ( bfd abfd,
elf_hppa_reloc_type  base_type,
int  format,
unsigned int  field,
int ignore  ATTRIBUTE_UNUSED,
asymbol *sym  ATTRIBUTE_UNUSED 
)

Definition at line 950 of file elf-hppa.h.

{
  elf_hppa_reloc_type *finaltype;
  elf_hppa_reloc_type **final_types;
  bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;

  /* Allocate slots for the BFD relocation.  */
  final_types = bfd_alloc (abfd, amt);
  if (final_types == NULL)
    return NULL;

  /* Allocate space for the relocation itself.  */
  amt = sizeof (elf_hppa_reloc_type);
  finaltype = bfd_alloc (abfd, amt);
  if (finaltype == NULL)
    return NULL;

  /* Some reasonable defaults.  */
  final_types[0] = finaltype;
  final_types[1] = NULL;

  *finaltype = elf_hppa_reloc_final_type (abfd, base_type, format, field);

  return final_types;
}

Here is the call graph for this function:

static unsigned int elf_hppa_action_discarded ( asection sec) [static]

Definition at line 1173 of file elf-hppa.h.

{
  if (strcmp (".PARISC.unwind", sec->name) == 0)
    return 0;

  return _bfd_elf_default_action_discarded (sec);
}

Here is the call graph for this function:

static bfd_boolean elf_hppa_fake_sections ( bfd abfd,
Elf_Internal_Shdr hdr,
asection sec 
) [static]

Definition at line 1050 of file elf-hppa.h.

{
  const char *name;

  name = bfd_get_section_name (abfd, sec);

  if (strcmp (name, ".PARISC.unwind") == 0)
    {
      int indx;
      asection *asec;

#if ARCH_SIZE == 64
      hdr->sh_type = SHT_LOPROC + 1;
#else
      hdr->sh_type = 1;
#endif
      /* ?!? How are unwinds supposed to work for symbols in arbitrary
        sections?  Or what if we have multiple .text sections in a single
        .o file?  HP really messed up on this one.

        Ugh.  We can not use elf_section_data (sec)->this_idx at this
        point because it is not initialized yet.

        So we (gasp) recompute it here.  Hopefully nobody ever changes the
        way sections are numbered in elf.c!  */
      for (asec = abfd->sections, indx = 1; asec; asec = asec->next, indx++)
       {
         if (asec->name && strcmp (asec->name, ".text") == 0)
           {
             hdr->sh_info = indx;
             break;
           }
       }

      /* I have no idea if this is really necessary or what it means.  */
      hdr->sh_entsize = 4;
    }
  return TRUE;
}

Here is the call graph for this function:

static void elf_hppa_final_write_processing ( bfd abfd,
bfd_boolean linker  ATTRIBUTE_UNUSED 
) [static]

Definition at line 1091 of file elf-hppa.h.

{
  int mach = bfd_get_mach (abfd);

  elf_elfheader (abfd)->e_flags &= ~(EF_PARISC_ARCH | EF_PARISC_TRAPNIL
                                 | EF_PARISC_EXT | EF_PARISC_LSB
                                 | EF_PARISC_WIDE | EF_PARISC_NO_KABP
                                 | EF_PARISC_LAZYSWAP);

  if (mach == 10)
    elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_0;
  else if (mach == 11)
    elf_elfheader (abfd)->e_flags |= EFA_PARISC_1_1;
  else if (mach == 20)
    elf_elfheader (abfd)->e_flags |= EFA_PARISC_2_0;
  else if (mach == 25)
    elf_elfheader (abfd)->e_flags |= (EF_PARISC_WIDE
                                  | EFA_PARISC_2_0
                                  /* The GNU tools have trapped without
                                    option since 1993, so need to take
                                    a step backwards with the ELF
                                    based toolchains.  */
                                  | EF_PARISC_TRAPNIL);
}

Here is the call graph for this function:

static void elf_hppa_info_to_howto ( bfd *abfd  ATTRIBUTE_UNUSED,
arelent bfd_reloc,
Elf_Internal_Rela elf_reloc 
) [static]

Definition at line 984 of file elf-hppa.h.

{
  BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
             < (unsigned int) R_PARISC_UNIMPLEMENTED);
  bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
}
static void elf_hppa_info_to_howto_rel ( bfd *abfd  ATTRIBUTE_UNUSED,
arelent bfd_reloc,
Elf_Internal_Rela elf_reloc 
) [static]

Definition at line 996 of file elf-hppa.h.

{
  BFD_ASSERT (ELF_R_TYPE (elf_reloc->r_info)
             < (unsigned int) R_PARISC_UNIMPLEMENTED);
  bfd_reloc->howto = &elf_hppa_howto_table[ELF_R_TYPE (elf_reloc->r_info)];
}
static bfd_boolean elf_hppa_is_local_label_name ( bfd *abfd  ATTRIBUTE_UNUSED,
const char *  name 
) [static]

Definition at line 1039 of file elf-hppa.h.

{
  if (name[0] == 'L' && name[1] == '$')
    return TRUE;
  return _bfd_elf_is_local_label_name (abfd, name);
}

Here is the call graph for this function:

elf_hppa_reloc_type elf_hppa_reloc_final_type ( bfd abfd,
elf_hppa_reloc_type  base_type,
int  format,
unsigned int  field 
)

Definition at line 584 of file elf-hppa.h.

{
  elf_hppa_reloc_type final_type = base_type;

  /* Just a tangle of nested switch statements to deal with the braindamage
     that a different field selector means a completely different relocation
     for PA ELF.  */
  switch (base_type)
    {
      /* We have been using generic relocation types.  However, that may not
        really make sense.  Anyway, we need to support both R_PARISC_DIR64
        and R_PARISC_DIR32 here.  */
    case R_PARISC_DIR32:
    case R_PARISC_DIR64:
    case R_HPPA_ABS_CALL:
      switch (format)
       {
       case 14:
         switch (field)
           {
           case e_fsel:
             final_type = R_PARISC_DIR14F;
             break;
           case e_rsel:
           case e_rrsel:
           case e_rdsel:
             final_type = R_PARISC_DIR14R;
             break;
           case e_rtsel:
             final_type = R_PARISC_DLTIND14R;
             break;
           case e_rtpsel:
             final_type = R_PARISC_LTOFF_FPTR14DR;
             break;
           case e_tsel:
             final_type = R_PARISC_DLTIND14F;
             break;
           case e_rpsel:
             final_type = R_PARISC_PLABEL14R;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 17:
         switch (field)
           {
           case e_fsel:
             final_type = R_PARISC_DIR17F;
             break;
           case e_rsel:
           case e_rrsel:
           case e_rdsel:
             final_type = R_PARISC_DIR17R;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 21:
         switch (field)
           {
           case e_lsel:
           case e_lrsel:
           case e_ldsel:
           case e_nlsel:
           case e_nlrsel:
             final_type = R_PARISC_DIR21L;
             break;
           case e_ltsel:
             final_type = R_PARISC_DLTIND21L;
             break;
           case e_ltpsel:
             final_type = R_PARISC_LTOFF_FPTR21L;
             break;
           case e_lpsel:
             final_type = R_PARISC_PLABEL21L;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 32:
         switch (field)
           {
           case e_fsel:
             final_type = R_PARISC_DIR32;
             /* When in 64bit mode, a 32bit relocation is supposed to
               be a section relative relocation.  Dwarf2 (for example)
               uses 32bit section relative relocations.  */
             if (bfd_get_arch_info (abfd)->bits_per_address != 32)
              final_type = R_PARISC_SECREL32;
             break;
           case e_psel:
             final_type = R_PARISC_PLABEL32;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 64:
         switch (field)
           {
           case e_fsel:
             final_type = R_PARISC_DIR64;
             break;
           case e_psel:
             final_type = R_PARISC_FPTR64;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       default:
         return R_PARISC_NONE;
       }
      break;

    case R_HPPA_GOTOFF:
      switch (format)
       {
       case 14:
         switch (field)
           {
           case e_rsel:
           case e_rrsel:
           case e_rdsel:
             /* R_PARISC_DLTREL14R for elf64, R_PARISC_DPREL14R for elf32.  */
             final_type = base_type + OFFSET_14R_FROM_21L;
             break;
           case e_fsel:
             /* R_PARISC_DLTREL14F for elf64, R_PARISC_DPREL14F for elf32.  */
             final_type = base_type + OFFSET_14F_FROM_21L;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 21:
         switch (field)
           {
           case e_lsel:
           case e_lrsel:
           case e_ldsel:
           case e_nlsel:
           case e_nlrsel:
             /* R_PARISC_DLTREL21L for elf64, R_PARISC_DPREL21L for elf32.  */
             final_type = base_type;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       default:
         return R_PARISC_NONE;
       }
      break;

    case R_HPPA_PCREL_CALL:
      switch (format)
       {
       case 12:
         switch (field)
           {
           case e_fsel:
             final_type = R_PARISC_PCREL12F;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 14:
         /* Contrary to appearances, these are not calls of any sort.
            Rather, they are loads/stores with a pcrel reloc.  */
         switch (field)
           {
           case e_rsel:
           case e_rrsel:
           case e_rdsel:
             final_type = R_PARISC_PCREL14R;
             break;
           case e_fsel:
             if (bfd_get_mach (abfd) < 25)
              final_type = R_PARISC_PCREL14F;
             else
              final_type = R_PARISC_PCREL16F;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 17:
         switch (field)
           {
           case e_rsel:
           case e_rrsel:
           case e_rdsel:
             final_type = R_PARISC_PCREL17R;
             break;
           case e_fsel:
             final_type = R_PARISC_PCREL17F;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 21:
         switch (field)
           {
           case e_lsel:
           case e_lrsel:
           case e_ldsel:
           case e_nlsel:
           case e_nlrsel:
             final_type = R_PARISC_PCREL21L;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 22:
         switch (field)
           {
           case e_fsel:
             final_type = R_PARISC_PCREL22F;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 32:
         switch (field)
           {
           case e_fsel:
             final_type = R_PARISC_PCREL32;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       case 64:
         switch (field)
           {
           case e_fsel:
             final_type = R_PARISC_PCREL64;
             break;
           default:
             return R_PARISC_NONE;
           }
         break;

       default:
         return R_PARISC_NONE;
       }
      break;

    case R_PARISC_TLS_GD21L:
      switch (field)
       {
         case e_ltsel:
         case e_lrsel:
           final_type = R_PARISC_TLS_GD21L;
           break;
         case e_rtsel:
         case e_rrsel:
           final_type = R_PARISC_TLS_GD14R;
           break;
         default:
           return R_PARISC_NONE;
       }
      break;

    case R_PARISC_TLS_LDM21L:
      switch (field)
       {
         case e_ltsel:
         case e_lrsel:
           final_type = R_PARISC_TLS_LDM21L;
           break;
         case e_rtsel:
         case e_rrsel:
           final_type = R_PARISC_TLS_LDM14R;
           break;
         default:
           return R_PARISC_NONE;
       }
      break;

    case R_PARISC_TLS_LDO21L:
      switch (field)
       {
         case e_lrsel:
           final_type = R_PARISC_TLS_LDO21L;
           break;
         case e_rrsel:
           final_type = R_PARISC_TLS_LDO14R;
           break;
         default:
           return R_PARISC_NONE;
       }
      break;

    case R_PARISC_TLS_IE21L:
      switch (field)
       {
         case e_ltsel:
         case e_lrsel:
           final_type = R_PARISC_TLS_IE21L;
           break;
         case e_rtsel:
         case e_rrsel:
           final_type = R_PARISC_TLS_IE14R;
           break;
         default:
           return R_PARISC_NONE;
       }
      break;

    case R_PARISC_TLS_LE21L:
      switch (field)
       {
         case e_lrsel:
           final_type = R_PARISC_TLS_LE21L;
           break;
         case e_rrsel:
           final_type = R_PARISC_TLS_LE14R;
           break;
         default:
           return R_PARISC_NONE;
       }
      break;

    case R_PARISC_GNU_VTENTRY:
    case R_PARISC_GNU_VTINHERIT:
    case R_PARISC_SEGREL32:
    case R_PARISC_SEGBASE:
      /* The defaults are fine for these cases.  */
      break;

    default:
      return R_PARISC_NONE;
    }

  return final_type;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static reloc_howto_type* elf_hppa_reloc_name_lookup ( bfd *abfd  ATTRIBUTE_UNUSED,
const char *  r_name 
) [static]

Definition at line 1021 of file elf-hppa.h.

{
  unsigned int i;

  for (i = 0;
       i < sizeof (elf_hppa_howto_table) / sizeof (elf_hppa_howto_table[0]);
       i++)
    if (elf_hppa_howto_table[i].name != NULL
       && strcasecmp (elf_hppa_howto_table[i].name, r_name) == 0)
      return &elf_hppa_howto_table[i];

  return NULL;
}

Here is the call graph for this function:

static reloc_howto_type* elf_hppa_reloc_type_lookup ( bfd *abfd  ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type  code 
) [static]

Definition at line 1009 of file elf-hppa.h.

{
  if ((int) code < (int) R_PARISC_UNIMPLEMENTED)
    {
      BFD_ASSERT ((int) elf_hppa_howto_table[(int) code].type == (int) code);
      return &elf_hppa_howto_table[(int) code];
    }
  return NULL;
}
static bfd_boolean elf_hppa_sort_unwind ( bfd abfd) [static]

Definition at line 1142 of file elf-hppa.h.

{
  asection *s;

  /* Magic section names, but this is much safer than having
     relocate_section remember where SEGREL32 relocs occurred.
     Consider what happens if someone inept creates a linker script
     that puts unwind information in .text.  */
  s = bfd_get_section_by_name (abfd, ".PARISC.unwind");
  if (s != NULL)
    {
      bfd_size_type size;
      bfd_byte *contents;

      if (!bfd_malloc_and_get_section (abfd, s, &contents))
       return FALSE;

      size = s->size;
      qsort (contents, (size_t) (size / 16), 16, hppa_unwind_entry_compare);

      if (! bfd_set_section_contents (abfd, s, contents, (file_ptr) 0, size))
       return FALSE;
    }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int hppa_unwind_entry_compare ( const void *  a,
const void *  b 
) [static]

Definition at line 1121 of file elf-hppa.h.

{
  const bfd_byte *ap, *bp;
  unsigned long av, bv;

  ap = a;
  av = (unsigned long) ap[0] << 24;
  av |= (unsigned long) ap[1] << 16;
  av |= (unsigned long) ap[2] << 8;
  av |= (unsigned long) ap[3];

  bp = b;
  bv = (unsigned long) bp[0] << 24;
  bv |= (unsigned long) bp[1] << 16;
  bv |= (unsigned long) bp[2] << 8;
  bv |= (unsigned long) bp[3];

  return av < bv ? -1 : av > bv ? 1 : 0;
}

Here is the caller graph for this function:


Variable Documentation

reloc_howto_type elf_hppa_howto_table[ELF_HOWTO_TABLE_SIZE] [static]

Definition at line 48 of file elf-hppa.h.