Back to index

cell-binutils  2.17cvs20070401
Defines | Functions
tc-mcore.h File Reference
#include "write.h"

Go to the source code of this file.

Defines

#define TARGET_ARCH   bfd_arch_mcore
#define TARGET_BYTES_BIG_ENDIAN   0
#define IGNORE_NONSTANDARD_ESCAPES
#define PSEUDO_LCOMM_OPTIONAL_ALIGN
#define LISTING_HEADER   "M.CORE GAS Version 2.9.4"
#define LISTING_LHS_CONT_LINES   4
#define LOCAL_LABELS_FB   1
#define TC_GENERIC_RELAX_TABLE   md_relax_table
#define md_end   md_mcore_end
#define MD_PCREL_FROM_SECTION(FIX, SEC)   md_pcrel_from_section (FIX, SEC)

Functions

void md_mcore_end (void)
long md_pcrel_from_section (fixS *, segT)
arelenttc_gen_reloc (asection *, fixS *)
int mcore_force_relocation (fixS *)
bfd_boolean mcore_fix_adjustable (fixS *)

Define Documentation

Definition at line 30 of file tc-mcore.h.

#define LISTING_HEADER   "M.CORE GAS Version 2.9.4"

Definition at line 35 of file tc-mcore.h.

#define LISTING_LHS_CONT_LINES   4

Definition at line 36 of file tc-mcore.h.

#define LOCAL_LABELS_FB   1

Definition at line 39 of file tc-mcore.h.

#define md_end   md_mcore_end

Definition at line 43 of file tc-mcore.h.

#define MD_PCREL_FROM_SECTION (   FIX,
  SEC 
)    md_pcrel_from_section (FIX, SEC)

Definition at line 46 of file tc-mcore.h.

Definition at line 33 of file tc-mcore.h.

Definition at line 26 of file tc-mcore.h.

#define TARGET_BYTES_BIG_ENDIAN   0

Definition at line 28 of file tc-mcore.h.

Definition at line 42 of file tc-mcore.h.


Function Documentation

void md_mcore_end ( void  )

Definition at line 1612 of file tc-mcore.c.

Here is the call graph for this function:

long md_pcrel_from_section ( fixS *  ,
segT   
)
arelent* tc_gen_reloc ( asection ,
fixS *   
)

Definition at line 1407 of file tc-hppa.c.

{
  arelent *reloc;
  struct hppa_fix_struct *hppa_fixp;
  static arelent *no_relocs = NULL;
  arelent **relocs;
  reloc_type **codes;
  reloc_type code;
  int n_relocs;
  int i;

  hppa_fixp = (struct hppa_fix_struct *) fixp->tc_fix_data;
  if (fixp->fx_addsy == 0)
    return &no_relocs;

  assert (hppa_fixp != 0);
  assert (section != 0);

  reloc = xmalloc (sizeof (arelent));

  reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
  *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
  codes = hppa_gen_reloc_type (stdoutput,
                            fixp->fx_r_type,
                            hppa_fixp->fx_r_format,
                            hppa_fixp->fx_r_field,
                            fixp->fx_subsy != NULL,
                            symbol_get_bfdsym (fixp->fx_addsy));

  if (codes == NULL)
    {
      as_bad_where (fixp->fx_file, fixp->fx_line, _("Cannot handle fixup"));
      abort ();
    }

  for (n_relocs = 0; codes[n_relocs]; n_relocs++)
    ;

  relocs = xmalloc (sizeof (arelent *) * n_relocs + 1);
  reloc = xmalloc (sizeof (arelent) * n_relocs);
  for (i = 0; i < n_relocs; i++)
    relocs[i] = &reloc[i];

  relocs[n_relocs] = NULL;

#ifdef OBJ_ELF
  switch (fixp->fx_r_type)
    {
    default:
      assert (n_relocs == 1);

      code = *codes[0];

      /* Now, do any processing that is dependent on the relocation type.  */
      switch (code)
       {
       case R_PARISC_DLTREL21L:
       case R_PARISC_DLTREL14R:
       case R_PARISC_DLTREL14F:
       case R_PARISC_PLABEL32:
       case R_PARISC_PLABEL21L:
       case R_PARISC_PLABEL14R:
         /* For plabel relocations, the addend of the
            relocation should be either 0 (no static link) or 2
            (static link required).  This adjustment is done in
            bfd/elf32-hppa.c:elf32_hppa_relocate_section.

            We also slam a zero addend into the DLT relative relocs;
            it doesn't make a lot of sense to use any addend since
            it gets you a different (eg unknown) DLT entry.  */
         reloc->addend = 0;
         break;

#ifdef ELF_ARG_RELOC
       case R_PARISC_PCREL17R:
       case R_PARISC_PCREL17F:
       case R_PARISC_PCREL17C:
       case R_PARISC_DIR17R:
       case R_PARISC_DIR17F:
       case R_PARISC_PCREL21L:
       case R_PARISC_DIR21L:
         reloc->addend = HPPA_R_ADDEND (hppa_fixp->fx_arg_reloc,
                                    fixp->fx_offset);
         break;
#endif

       case R_PARISC_DIR32:
         /* Facilitate hand-crafted unwind info.  */
         if (strcmp (section->name, UNWIND_SECTION_NAME) == 0)
           code = R_PARISC_SEGREL32;
         /* Fall thru */

       default:
         reloc->addend = fixp->fx_offset;
         break;
       }

      reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
      *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
      reloc->howto = bfd_reloc_type_lookup (stdoutput,
                                       (bfd_reloc_code_real_type) code);
      reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;

      assert (reloc->howto && (unsigned int) code == reloc->howto->type);
      break;
    }
#else /* OBJ_SOM */

  /* Walk over reach relocation returned by the BFD backend.  */
  for (i = 0; i < n_relocs; i++)
    {
      code = *codes[i];

      relocs[i]->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
      *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
      relocs[i]->howto =
       bfd_reloc_type_lookup (stdoutput,
                            (bfd_reloc_code_real_type) code);
      relocs[i]->address = fixp->fx_frag->fr_address + fixp->fx_where;

      switch (code)
       {
       case R_COMP2:
         /* The only time we ever use a R_COMP2 fixup is for the difference
            of two symbols.  With that in mind we fill in all four
            relocs now and break out of the loop.  */
         assert (i == 1);
         relocs[0]->sym_ptr_ptr
           = (asymbol **) bfd_abs_section_ptr->symbol_ptr_ptr;
         relocs[0]->howto
           = bfd_reloc_type_lookup (stdoutput,
                                 (bfd_reloc_code_real_type) *codes[0]);
         relocs[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
         relocs[0]->addend = 0;
         relocs[1]->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
         *relocs[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
         relocs[1]->howto
           = bfd_reloc_type_lookup (stdoutput,
                                 (bfd_reloc_code_real_type) *codes[1]);
         relocs[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
         relocs[1]->addend = 0;
         relocs[2]->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
         *relocs[2]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
         relocs[2]->howto
           = bfd_reloc_type_lookup (stdoutput,
                                 (bfd_reloc_code_real_type) *codes[2]);
         relocs[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
         relocs[2]->addend = 0;
         relocs[3]->sym_ptr_ptr
           = (asymbol **) bfd_abs_section_ptr->symbol_ptr_ptr;
         relocs[3]->howto
           = bfd_reloc_type_lookup (stdoutput,
                                 (bfd_reloc_code_real_type) *codes[3]);
         relocs[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
         relocs[3]->addend = 0;
         relocs[4]->sym_ptr_ptr
           = (asymbol **) bfd_abs_section_ptr->symbol_ptr_ptr;
         relocs[4]->howto
           = bfd_reloc_type_lookup (stdoutput,
                                 (bfd_reloc_code_real_type) *codes[4]);
         relocs[4]->address = fixp->fx_frag->fr_address + fixp->fx_where;
         relocs[4]->addend = 0;
         goto done;
       case R_PCREL_CALL:
       case R_ABS_CALL:
         relocs[i]->addend = HPPA_R_ADDEND (hppa_fixp->fx_arg_reloc, 0);
         break;

       case R_DLT_REL:
       case R_DATA_PLABEL:
       case R_CODE_PLABEL:
         /* For plabel relocations, the addend of the
            relocation should be either 0 (no static link) or 2
            (static link required).

            FIXME: We always assume no static link!

            We also slam a zero addend into the DLT relative relocs;
            it doesn't make a lot of sense to use any addend since
            it gets you a different (eg unknown) DLT entry.  */
         relocs[i]->addend = 0;
         break;

       case R_N_MODE:
       case R_S_MODE:
       case R_D_MODE:
       case R_R_MODE:
       case R_FSEL:
       case R_LSEL:
       case R_RSEL:
       case R_BEGIN_BRTAB:
       case R_END_BRTAB:
       case R_BEGIN_TRY:
       case R_N0SEL:
       case R_N1SEL:
         /* There is no symbol or addend associated with these fixups.  */
         relocs[i]->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
         *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol);
         relocs[i]->addend = 0;
         break;

       case R_END_TRY:
       case R_ENTRY:
       case R_EXIT:
         /* There is no symbol associated with these fixups.  */
         relocs[i]->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
         *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol);
         relocs[i]->addend = fixp->fx_offset;
         break;

       default:
         relocs[i]->addend = fixp->fx_offset;
       }
    }

 done:
#endif

  return relocs;
}