Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
tc-m32r.h File Reference

Go to the source code of this file.

Defines

#define TC_M32R
#define LISTING_HEADER   (target_big_endian ? "M32R GAS" : "M32R GAS Little Endian")
#define TARGET_ARCH   bfd_arch_m32r
#define TARGET_FORMAT   m32r_target_format()
#define TARGET_BYTES_BIG_ENDIAN   1
#define MD_PCREL_FROM_SECTION(FIX, SEC)   md_pcrel_from_section(FIX, SEC)
#define LOCAL_LABELS_FB   1
#define DIFF_EXPR_OK   /* .-foo gets turned into PC relative relocs. */
#define WORKING_DOT_WORD
#define TC_GENERIC_RELAX_TABLE   md_relax_table
#define md_relax_frag(segment, fragP, stretch)   m32r_relax_frag (segment, fragP, stretch)
#define TC_CGEN_MAX_RELAX(insn, len)   6
#define HANDLE_ALIGN(f)   m32r_handle_align (f)
#define MAX_MEM_FOR_RS_ALIGN_CODE   (1 + 2 + 4)
#define MD_APPLY_SYM_VALUE(FIX)   0
#define md_apply_fix   gas_cgen_md_apply_fix
#define tc_fix_adjustable(FIX)   m32r_fix_adjustable (FIX)
#define md_cgen_record_fixup_exp   m32r_cgen_record_fixup_exp
#define TC_HANDLES_FX_DONE
#define TC_FIX_ADJUSTABLE(fixP)   obj_fix_adjustable (fixP)
#define tc_frob_file_before_fix()   m32r_frob_file ()
#define TC_FORCE_RELOCATION(fix)   m32r_force_relocation (fix)
#define md_after_pass_hook()   m32r_fill_insn (1)
#define TC_START_LABEL(ch, ptr)   (ch == ':' && m32r_fill_insn (0))
#define md_cleanup   m32r_elf_section_change_hook
#define md_elf_section_change_hook   m32r_elf_section_change_hook
#define md_flush_pending_output()   m32r_flush_pending_output ()
#define elf_tc_final_processing   m32r_elf_final_processing
#define md_parse_name(name, exprP, mode, nextcharP)   m32r_parse_name ((name), (exprP), (mode), (nextcharP))
#define O_PIC_reloc   O_md1
#define TC_CGEN_PARSE_FIX_EXP(opinfo, exp)   m32r_cgen_parse_fix_exp(opinfo, exp)

Functions

const char * m32r_target_format (void)
long md_pcrel_from_section (struct fix *, segT)
long m32r_relax_frag (segT, fragS *, long)
void m32r_handle_align (fragS *)
bfd_boolean m32r_fix_adjustable (struct fix *)
void m32r_frob_file (void)
int m32r_force_relocation (struct fix *)
int m32r_fill_insn (int)
void m32r_elf_section_change_hook (void)
void m32r_flush_pending_output (void)
void m32r_elf_final_processing (void)
int m32r_parse_name (char const *, expressionS *, enum expr_mode, char *)
int m32r_cgen_parse_fix_exp (int, expressionS *)

Variables

int pic_code

Define Documentation

#define DIFF_EXPR_OK   /* .-foo gets turned into PC relative relocs. */

Definition at line 47 of file tc-m32r.h.

Definition at line 114 of file tc-m32r.h.

#define HANDLE_ALIGN (   f)    m32r_handle_align (f)

Definition at line 65 of file tc-m32r.h.

#define LISTING_HEADER   (target_big_endian ? "M32R GAS" : "M32R GAS Little Endian")

Definition at line 24 of file tc-m32r.h.

#define LOCAL_LABELS_FB   1

Definition at line 45 of file tc-m32r.h.

#define MAX_MEM_FOR_RS_ALIGN_CODE   (1 + 2 + 4)

Definition at line 67 of file tc-m32r.h.

#define md_after_pass_hook ( )    m32r_fill_insn (1)

Definition at line 104 of file tc-m32r.h.

Definition at line 72 of file tc-m32r.h.

#define MD_APPLY_SYM_VALUE (   FIX)    0

Definition at line 70 of file tc-m32r.h.

Definition at line 79 of file tc-m32r.h.

Definition at line 107 of file tc-m32r.h.

Definition at line 108 of file tc-m32r.h.

Definition at line 111 of file tc-m32r.h.

#define md_parse_name (   name,
  exprP,
  mode,
  nextcharP 
)    m32r_parse_name ((name), (exprP), (mode), (nextcharP))

Definition at line 117 of file tc-m32r.h.

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

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

#define md_relax_frag (   segment,
  fragP,
  stretch 
)    m32r_relax_frag (segment, fragP, stretch)

Definition at line 57 of file tc-m32r.h.

#define O_PIC_reloc   O_md1

Definition at line 123 of file tc-m32r.h.

#define TARGET_ARCH   bfd_arch_m32r

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

#define TARGET_BYTES_BIG_ENDIAN   1

Definition at line 37 of file tc-m32r.h.

Definition at line 32 of file tc-m32r.h.

#define TC_CGEN_MAX_RELAX (   insn,
  len 
)    6

Definition at line 61 of file tc-m32r.h.

Definition at line 125 of file tc-m32r.h.

Definition at line 74 of file tc-m32r.h.

#define TC_FIX_ADJUSTABLE (   fixP)    obj_fix_adjustable (fixP)

Definition at line 89 of file tc-m32r.h.

Definition at line 99 of file tc-m32r.h.

Definition at line 91 of file tc-m32r.h.

Definition at line 54 of file tc-m32r.h.

Definition at line 81 of file tc-m32r.h.

#define TC_M32R

Definition at line 22 of file tc-m32r.h.

#define TC_START_LABEL (   ch,
  ptr 
)    (ch == ':' && m32r_fill_insn (0))

Definition at line 105 of file tc-m32r.h.

Definition at line 50 of file tc-m32r.h.


Function Documentation

Definition at line 2452 of file tc-m32r.c.

{
  if (exp->X_op == O_PIC_reloc
      && exp->X_md == BFD_RELOC_M32R_26_PLTREL)
    {
      exp->X_op = O_symbol;
      opinfo = exp->X_md;
    }

  return opinfo;
}
void m32r_elf_final_processing ( void  )

Definition at line 2239 of file tc-m32r.c.

Definition at line 2173 of file tc-m32r.c.

{
  /* If we have reached the end of a section and we have just emitted a
     16 bit insn, then emit a nop to make sure that the section ends on
     a 32 bit boundary.  */

  if (prev_insn.insn || seen_relaxable_p)
    (void) m32r_fill_insn (0);
}

Here is the call graph for this function:

Definition at line 643 of file tc-m32r.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void m32r_flush_pending_output ( void  )

Definition at line 629 of file tc-m32r.c.

Here is the call graph for this function:

void m32r_frob_file ( void  )

Definition at line 2001 of file tc-m32r.c.

{
  struct m32r_hi_fixup *l;

  for (l = m32r_hi_fixup_list; l != NULL; l = l->next)
    {
      segment_info_type *seginfo;
      int pass;

      assert (FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_M32R_HI16_SLO
             || FX_OPINFO_R_TYPE (l->fixp) == BFD_RELOC_M32R_HI16_ULO);

      /* Check quickly whether the next fixup happens to be a matching low.  */
      if (l->fixp->fx_next != NULL
         && FX_OPINFO_R_TYPE (l->fixp->fx_next) == BFD_RELOC_M32R_LO16
         && l->fixp->fx_addsy == l->fixp->fx_next->fx_addsy
         && l->fixp->fx_offset == l->fixp->fx_next->fx_offset)
       continue;

      /* Look through the fixups for this segment for a matching `low'.
         When we find one, move the high/shigh just in front of it.  We do
         this in two passes.  In the first pass, we try to find a
         unique `low'.  In the second pass, we permit multiple high's
         relocs for a single `low'.  */
      seginfo = seg_info (l->seg);
      for (pass = 0; pass < 2; pass++)
       {
         fixS *f;
         fixS *prev;

         prev = NULL;
         for (f = seginfo->fix_root; f != NULL; f = f->fx_next)
           {
             /* Check whether this is a `low' fixup which matches l->fixp.  */
             if (FX_OPINFO_R_TYPE (f) == BFD_RELOC_M32R_LO16
                && f->fx_addsy == l->fixp->fx_addsy
                && f->fx_offset == l->fixp->fx_offset
                && (pass == 1
                    || prev == NULL
                    || (FX_OPINFO_R_TYPE (prev) != BFD_RELOC_M32R_HI16_SLO
                       && FX_OPINFO_R_TYPE (prev) != BFD_RELOC_M32R_HI16_ULO)
                    || prev->fx_addsy != f->fx_addsy
                    || prev->fx_offset != f->fx_offset))
              {
                fixS **pf;

                /* Move l->fixp before f.  */
                for (pf = &seginfo->fix_root;
                     *pf != l->fixp;
                     pf = & (*pf)->fx_next)
                  assert (*pf != NULL);

                *pf = l->fixp->fx_next;

                l->fixp->fx_next = f;
                if (prev == NULL)
                  seginfo->fix_root = l->fixp;
                else
                  prev->fx_next = l->fixp;

                break;
              }

             prev = f;
           }

         if (f != NULL)
           break;

         if (pass == 1
             && warn_unmatched_high)
           as_warn_where (l->fixp->fx_file, l->fixp->fx_line,
                        _("Unmatched high/shigh reloc"));
       }
    }
}

Here is the call graph for this function:

void m32r_handle_align ( fragS *  )

Definition at line 507 of file tc-m32r.c.

{
  static const unsigned char nop_pattern[] = { 0xf0, 0x00 };
  static const unsigned char multi_nop_pattern[] = { 0x70, 0x00, 0xf0, 0x00 };

  int bytes, fix;
  char *p;

  if (fragp->fr_type != rs_align_code)
    return;

  bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
  p = fragp->fr_literal + fragp->fr_fix;
  fix = 0;

  if (bytes & 1)
    {
      fix = 1;
      *p++ = 0;
      bytes--;
    }

  if (bytes & 2)
    {
      memcpy (p, nop_pattern, 2);
      p += 2;
      bytes -= 2;
      fix += 2;
    }

  memcpy (p, multi_nop_pattern, 4);

  fragp->fr_fix += fix;
  fragp->fr_var = 4;
}

Here is the call graph for this function:

int m32r_parse_name ( char const ,
expressionS ,
enum  expr_mode,
char *   
)

Definition at line 2372 of file tc-m32r.c.

{
  char *next = input_line_pointer;
  char *next_end;
  int reloc_type;
  operatorT op_type;
  segT segment;

  exprP->X_op_symbol = NULL;
  exprP->X_md = BFD_RELOC_UNUSED;

  if (strcmp (name, GOT_NAME) == 0)
    {
      if (! GOT_symbol)
       GOT_symbol = symbol_find_or_make (name);

      exprP->X_add_symbol = GOT_symbol;
    no_suffix:
      /* If we have an absolute symbol or a
        reg, then we know its value now.  */
      segment = S_GET_SEGMENT (exprP->X_add_symbol);
      if (mode != expr_defer && segment == absolute_section)
       {
         exprP->X_op = O_constant;
         exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
         exprP->X_add_symbol = NULL;
       }
      else if (mode != expr_defer && segment == reg_section)
       {
         exprP->X_op = O_register;
         exprP->X_add_number = S_GET_VALUE (exprP->X_add_symbol);
         exprP->X_add_symbol = NULL;
       }
      else
       {
         exprP->X_op = O_symbol;
         exprP->X_add_number = 0;
       }

      return 1;
    }

  exprP->X_add_symbol = symbol_find_or_make (name);

  if (*nextcharP != '@')
    goto no_suffix;
  else if ((next_end = m32r_end_of_match (next + 1, "GOTOFF")))
    {
      reloc_type = BFD_RELOC_M32R_GOTOFF;
      op_type = O_PIC_reloc;
    }
  else if ((next_end = m32r_end_of_match (next + 1, "GOT")))
    {
      reloc_type = BFD_RELOC_M32R_GOT24;
      op_type = O_PIC_reloc;
    }
  else if ((next_end = m32r_end_of_match (next + 1, "PLT")))
    {
      reloc_type = BFD_RELOC_M32R_26_PLTREL;
      op_type = O_PIC_reloc;
    }
  else
    goto no_suffix;

  *input_line_pointer = *nextcharP;
  input_line_pointer = next_end;
  *nextcharP = *input_line_pointer;
  *input_line_pointer = '\0';

  exprP->X_op = op_type;
  exprP->X_add_number = 0;
  exprP->X_md = reloc_type;

  return 1;
}

Here is the call graph for this function:

long m32r_relax_frag ( segT  ,
fragS *  ,
long   
)

Definition at line 1643 of file tc-m32r.c.

{
  /* Address of branch insn.  */
  long address = fragP->fr_address + fragP->fr_fix - 2;
  long growth = 0;

  /* Keep 32 bit insns aligned on 32 bit boundaries.  */
  if (fragP->fr_subtype == 2)
    {
      if ((address & 3) != 0)
       {
         fragP->fr_subtype = 3;
         growth = 2;
       }
    }
  else if (fragP->fr_subtype == 3)
    {
      if ((address & 3) == 0)
       {
         fragP->fr_subtype = 2;
         growth = -2;
       }
    }
  else
    {
      growth = relax_frag (segment, fragP, stretch);

      /* Long jump on odd halfword boundary?  */
      if (fragP->fr_subtype == 2 && (address & 3) != 0)
       {
         fragP->fr_subtype = 3;
         growth += 2;
       }
    }

  return growth;
}

Here is the call graph for this function:

const char* m32r_target_format ( void  )

Definition at line 669 of file tc-m32r.c.

{
#ifdef TE_LINUX
  if (target_big_endian)
    return "elf32-m32r-linux";
  else
    return "elf32-m32rle-linux";
#else
  if (target_big_endian)
    return "elf32-m32r";
  else
    return "elf32-m32rle";
#endif
}

Variable Documentation

Definition at line 73 of file tc-m32r.c.