Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
coff-m88k.c File Reference
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "coff/m88k.h"
#include "coff/internal.h"
#include "libcoff.h"
#include "coffcode.h"

Go to the source code of this file.

Defines

#define M88   1 /* Customize various include files */
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER   (3)
#define GET_SCNHDR_NRELOC   H_GET_32
#define GET_SCNHDR_NLNNO   H_GET_32
#define coff_bfd_is_local_label_name   m88k_is_local_label_name
#define RTYPE2HOWTO(cache_ptr, dst)   rtype2howto (cache_ptr, dst)
#define SWAP_IN_RELOC_OFFSET   H_GET_16
#define SWAP_OUT_RELOC_OFFSET   H_PUT_16
#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section)   reloc_processing(relent, reloc, symbols, abfd, section)
#define BADMAG(x)   MC88BADMAG(x)

Functions

static bfd_boolean
m88k_is_local_label_name 
PARAMS ((bfd *, const char *))
static bfd_reloc_status_type
m88k_special_reloc 
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **))
static void rtype2howto PARAMS ((arelent *, struct internal_reloc *))
static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *))
static bfd_boolean m88k_is_local_label_name (abfd, const char *name)
static bfd_reloc_status_type m88k_special_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol, PTR data, asection *input_section, bfd *output_bfd, error_message)
static void rtype2howto (arelent *cache_ptr, struct internal_reloc *dst)
static void reloc_processing (arelent *relent, struct internal_reloc *reloc, asymbol **symbols, bfd *abfd, asection *section)

Variables

static reloc_howto_type howto_table []

Define Documentation

#define BADMAG (   x)    MC88BADMAG(x)

Definition at line 286 of file coff-m88k.c.

Definition at line 45 of file coff-m88k.c.

Definition at line 38 of file coff-m88k.c.

#define GET_SCNHDR_NLNNO   H_GET_32

Definition at line 41 of file coff-m88k.c.

Definition at line 40 of file coff-m88k.c.

#define M88   1 /* Customize various include files */

Definition at line 23 of file coff-m88k.c.

#define RELOC_PROCESSING (   relent,
  reloc,
  symbols,
  abfd,
  section 
)    reloc_processing(relent, reloc, symbols, abfd, section)

Definition at line 259 of file coff-m88k.c.

#define RTYPE2HOWTO (   cache_ptr,
  dst 
)    rtype2howto (cache_ptr, dst)

Definition at line 253 of file coff-m88k.c.

Definition at line 256 of file coff-m88k.c.

Definition at line 257 of file coff-m88k.c.


Function Documentation

static bfd_boolean m88k_is_local_label_name ( abfd  ,
const char *  name 
) [static]

Definition at line 48 of file coff-m88k.c.

{
  return name[0] == '@';
}
static bfd_reloc_status_type m88k_special_reloc ( bfd abfd,
arelent reloc_entry,
asymbol symbol,
PTR  data,
asection input_section,
bfd output_bfd,
error_message   
) [static]

Definition at line 56 of file coff-m88k.c.

{
  reloc_howto_type *howto = reloc_entry->howto;

  switch (howto->type)
    {
    case R_HVRT16:
    case R_LVRT16:
      if (output_bfd != (bfd *) NULL)
       {
         /* This is a partial relocation, and we want to apply the
            relocation to the reloc entry rather than the raw data.
            Modify the reloc inplace to reflect what we now know.  */

         reloc_entry->address += input_section->output_offset;
       }
      else
       {
         bfd_vma output_base = 0;
         bfd_vma addr = reloc_entry->address;
         bfd_vma x = bfd_get_16 (abfd, (bfd_byte *) data + addr);
         asection *reloc_target_output_section;
         long relocation = 0;

         /* Work out which section the relocation is targeted at and the
            initial relocation command value.  */

         /* Get symbol value.  (Common symbols are special.)  */
         if (bfd_is_com_section (symbol->section))
           relocation = 0;
         else
           relocation = symbol->value;

         reloc_target_output_section = symbol->section->output_section;

         /* Convert input-section-relative symbol value to absolute.  */
         if (output_bfd)
           output_base = 0;
         else
           output_base = reloc_target_output_section->vma;

         relocation += output_base + symbol->section->output_offset;

         /* Add in supplied addend.  */
         relocation += ((reloc_entry->addend << howto->bitsize) + x);

         reloc_entry->addend = 0;

         relocation >>= (bfd_vma) howto->rightshift;

         /* Shift everything up to where it's going to be used */

         relocation <<= (bfd_vma) howto->bitpos;

         if (relocation)
           bfd_put_16 (abfd, (bfd_vma) relocation,
                     (unsigned char *) data + addr);
       }

      /* If we are not producing relocatable output, return an error if
        the symbol is not defined.  */
      if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL)
       return bfd_reloc_undefined;

      return bfd_reloc_ok;

    default:
      if (output_bfd != (bfd *) NULL)
       {
         /* This is a partial relocation, and we want to apply the
            relocation to the reloc entry rather than the raw data.
            Modify the reloc inplace to reflect what we now know.  */

         reloc_entry->address += input_section->output_offset;
         return bfd_reloc_ok;
       }
      break;
    }

  if (output_bfd == (bfd *) NULL)
    return bfd_reloc_continue;

  return bfd_reloc_ok;
}
static bfd_boolean m88k_is_local_label_name PARAMS ( (bfd *, const char *)  ) [static]
static bfd_reloc_status_type m88k_special_reloc PARAMS ( (bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)  ) [static]
static void rtype2howto PARAMS ( (arelent *, struct internal_reloc *)  ) [static]
static void reloc_processing PARAMS ( (arelent *, struct internal_reloc *, asymbol **, bfd *, asection *)  ) [static]
static void reloc_processing ( arelent relent,
struct internal_reloc reloc,
asymbol **  symbols,
bfd abfd,
asection section 
) [static]

Definition at line 263 of file coff-m88k.c.

{
  relent->address = reloc->r_vaddr;
  rtype2howto (relent, reloc);

  if (((int) reloc->r_symndx) > 0)
    {
      relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
    }
  else
    {
      relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
    }

  relent->addend = reloc->r_offset;
  relent->address -= section->vma;
}

Here is the call graph for this function:

static void rtype2howto ( arelent cache_ptr,
struct internal_reloc dst 
) [static]

Definition at line 239 of file coff-m88k.c.

{
  if (dst->r_type >= R_PCR16L && dst->r_type <= R_VRT32)
    {
      cache_ptr->howto = howto_table + dst->r_type - R_PCR16L;
    }
  else
    {
      BFD_ASSERT (0);
    }
}

Here is the caller graph for this function:


Variable Documentation

reloc_howto_type howto_table[] [static]

Definition at line 149 of file coff-m88k.c.