Back to index

cell-binutils  2.17cvs20070401
Classes | Defines | Functions | Variables
elf32-m68hc12.c File Reference
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf32-m68hc1x.h"
#include "elf/m68hc11.h"
#include "opcode/m68hc11.h"
#include "elf32-target.h"

Go to the source code of this file.

Classes

struct  m68hc11_reloc_map

Defines

#define USE_REL   1
#define ELF_ARCH   bfd_arch_m68hc12
#define ELF_MACHINE_CODE   EM_68HC12
#define ELF_MAXPAGESIZE   0x1000
#define TARGET_BIG_SYM   bfd_elf32_m68hc12_vec
#define TARGET_BIG_NAME   "elf32-m68hc12"
#define elf_info_to_howto   0
#define elf_info_to_howto_rel   m68hc11_info_to_howto_rel
#define elf_backend_check_relocs   elf32_m68hc11_check_relocs
#define elf_backend_relocate_section   elf32_m68hc11_relocate_section
#define elf_backend_object_p   m68hc12_elf_set_mach_from_flags
#define elf_backend_final_write_processing   0
#define elf_backend_can_gc_sections   1
#define elf_backend_special_sections   elf32_m68hc12_special_sections
#define elf_backend_post_process_headers   elf32_m68hc11_post_process_headers
#define elf_backend_add_symbol_hook   elf32_m68hc11_add_symbol_hook
#define bfd_elf32_bfd_link_hash_table_create   m68hc12_elf_bfd_link_hash_table_create
#define bfd_elf32_bfd_link_hash_table_free   m68hc11_elf_bfd_link_hash_table_free
#define bfd_elf32_bfd_merge_private_bfd_data   _bfd_m68hc11_elf_merge_private_bfd_data
#define bfd_elf32_bfd_set_private_flags   _bfd_m68hc11_elf_set_private_flags
#define bfd_elf32_bfd_print_private_bfd_data   _bfd_m68hc11_elf_print_private_bfd_data

Functions

static reloc_howto_type * bfd_elf32_bfd_reloc_type_lookup (bfd *, bfd_reloc_code_real_type)
static void m68hc11_info_to_howto_rel (bfd *, arelent *, Elf_Internal_Rela *)
static bfd_boolean m68hc12_elf_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
static bfd_boolean m68hc12_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
static struct bfd_link_hash_tablem68hc12_elf_bfd_link_hash_table_create (bfd *)
static bfd_boolean
m68hc12_elf_set_mach_from_flags 
PARAMS ((bfd *))
static reloc_howto_type * bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_type code)
static reloc_howto_type * bfd_elf32_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
static void m68hc11_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr, Elf_Internal_Rela *dst)
static bfd_boolean m68hc12_elf_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_UNUSED)
static bfd_boolean m68hc12_elf_set_mach_from_flags (bfd *abfd)

Variables

static reloc_howto_type elf_m68hc11_howto_table []
static struct m68hc11_reloc_map []
static struct bfd_elf_special_section []

Class Documentation

struct m68hc11_reloc_map

Definition at line 316 of file elf32-m68hc11.c.

Class Members
bfd_reloc_code_real_type bfd_reloc_val
unsigned char elf_reloc_val

Define Documentation

Definition at line 583 of file elf32-m68hc12.c.

Definition at line 585 of file elf32-m68hc12.c.

Definition at line 587 of file elf32-m68hc12.c.

Definition at line 590 of file elf32-m68hc12.c.

Definition at line 589 of file elf32-m68hc12.c.

#define ELF_ARCH   bfd_arch_m68hc12

Definition at line 565 of file elf32-m68hc12.c.

Definition at line 581 of file elf32-m68hc12.c.

Definition at line 578 of file elf32-m68hc12.c.

Definition at line 574 of file elf32-m68hc12.c.

Definition at line 577 of file elf32-m68hc12.c.

Definition at line 576 of file elf32-m68hc12.c.

Definition at line 580 of file elf32-m68hc12.c.

Definition at line 575 of file elf32-m68hc12.c.

#define elf_backend_special_sections   elf32_m68hc12_special_sections

Definition at line 579 of file elf32-m68hc12.c.

#define elf_info_to_howto   0

Definition at line 572 of file elf32-m68hc12.c.

Definition at line 573 of file elf32-m68hc12.c.

Definition at line 566 of file elf32-m68hc12.c.

#define ELF_MAXPAGESIZE   0x1000

Definition at line 567 of file elf32-m68hc12.c.

#define TARGET_BIG_NAME   "elf32-m68hc12"

Definition at line 570 of file elf32-m68hc12.c.

Definition at line 569 of file elf32-m68hc12.c.

#define USE_REL   1

Definition at line 49 of file elf32-m68hc12.c.


Function Documentation

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

Definition at line 411 of file elf32-m68hc12.c.

{
  unsigned int i;

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

  return NULL;
}

Here is the call graph for this function:

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

Definition at line 394 of file elf32-m68hc12.c.

{
  unsigned int i;

  for (i = 0;
       i < sizeof (m68hc11_reloc_map) / sizeof (struct m68hc11_reloc_map);
       i++)
    {
      if (m68hc11_reloc_map[i].bfd_reloc_val == code)
       return &elf_m68hc11_howto_table[m68hc11_reloc_map[i].elf_reloc_val];
    }

  return NULL;
}
static void m68hc11_info_to_howto_rel ( bfd ,
arelent ,
Elf_Internal_Rela  
) [static]
static void m68hc11_info_to_howto_rel ( bfd *abfd  ATTRIBUTE_UNUSED,
arelent cache_ptr,
Elf_Internal_Rela dst 
) [static]

Definition at line 430 of file elf32-m68hc12.c.

{
  unsigned int r_type;

  r_type = ELF32_R_TYPE (dst->r_info);
  BFD_ASSERT (r_type < (unsigned int) R_M68HC11_max);
  cache_ptr->howto = &elf_m68hc11_howto_table[r_type];
}

Definition at line 514 of file elf32-m68hc12.c.

{
  struct m68hc11_elf_link_hash_table *ret;

  ret = m68hc11_elf_hash_table_create (abfd);
  if (ret == (struct m68hc11_elf_link_hash_table *) NULL)
    return NULL;

  ret->size_one_stub = m68hc12_elf_size_one_stub;
  ret->build_one_stub = m68hc12_elf_build_one_stub;

  return &ret->root.root;
}

Here is the call graph for this function:

static bfd_boolean m68hc12_elf_build_one_stub ( struct bfd_hash_entry gen_entry,
void *  in_arg 
) [static]

Definition at line 445 of file elf32-m68hc12.c.

{
  struct elf32_m68hc11_stub_hash_entry *stub_entry;
  struct bfd_link_info *info;
  struct m68hc11_elf_link_hash_table *htab;
  asection *stub_sec;
  bfd *stub_bfd;
  bfd_byte *loc;
  bfd_vma sym_value, phys_page, phys_addr;

  /* Massage our args to the form they really have.  */
  stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry;
  info = (struct bfd_link_info *) in_arg;

  htab = m68hc11_elf_hash_table (info);

  stub_sec = stub_entry->stub_sec;

  /* Make a note of the offset within the stubs for this entry.  */
  stub_entry->stub_offset = stub_sec->size;
  stub_sec->size += 7;
  loc = stub_sec->contents + stub_entry->stub_offset;

  stub_bfd = stub_sec->owner;

  /* Create the trampoline call stub:

     ldy #%addr(symbol)
     call %page(symbol), __trampoline

  */
  sym_value = (stub_entry->target_value
               + stub_entry->target_section->output_offset
               + stub_entry->target_section->output_section->vma);
  phys_addr = m68hc11_phys_addr (&htab->pinfo, sym_value);
  phys_page = m68hc11_phys_page (&htab->pinfo, sym_value);

  /* ldy #%page(sym) */
  bfd_put_8 (stub_bfd, 0xCD, loc);
  bfd_put_16 (stub_bfd, phys_addr, loc + 1);
  loc += 3;

  /* call %page(sym), __trampoline  */
  bfd_put_8 (stub_bfd, 0x4a, loc);
  bfd_put_16 (stub_bfd, htab->pinfo.trampoline_addr, loc + 1);
  bfd_put_8 (stub_bfd, phys_page, loc + 3);

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bfd_boolean m68hc12_elf_set_mach_from_flags ( bfd abfd) [static]

Definition at line 529 of file elf32-m68hc12.c.

Here is the call graph for this function:

static bfd_boolean m68hc12_elf_size_one_stub ( struct bfd_hash_entry gen_entry,
void *  in_arg 
) [static]

Here is the caller graph for this function:

static bfd_boolean m68hc12_elf_size_one_stub ( struct bfd_hash_entry gen_entry,
void *in_arg  ATTRIBUTE_UNUSED 
) [static]

Definition at line 499 of file elf32-m68hc12.c.

{
  struct elf32_m68hc11_stub_hash_entry *stub_entry;

  /* Massage our args to the form they really have.  */
  stub_entry = (struct elf32_m68hc11_stub_hash_entry *) gen_entry;

  stub_entry->stub_sec->size += 7;
  return TRUE;
}

Variable Documentation

Initial value:
{
  { STRING_COMMA_LEN (".eeprom"),   0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
  { STRING_COMMA_LEN (".page0"),    0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
  { STRING_COMMA_LEN (".softregs"), 0, SHT_NOBITS,   SHF_ALLOC + SHF_WRITE },
  { STRING_COMMA_LEN (".vectors"),  0, SHT_PROGBITS, SHF_ALLOC },
  { NULL,                       0,  0, 0,            0 }
}

Definition at line 556 of file elf32-m68hc12.c.

reloc_howto_type elf_m68hc11_howto_table[] [static]

Definition at line 113 of file elf32-m68hc12.c.

Initial value:
 {
  {BFD_RELOC_NONE, R_M68HC11_NONE,},
  {BFD_RELOC_8, R_M68HC11_8},
  {BFD_RELOC_M68HC11_HI8, R_M68HC11_HI8},
  {BFD_RELOC_M68HC11_LO8, R_M68HC11_LO8},
  {BFD_RELOC_8_PCREL, R_M68HC11_PCREL_8},
  {BFD_RELOC_16_PCREL, R_M68HC11_PCREL_16},
  {BFD_RELOC_16, R_M68HC11_16},
  {BFD_RELOC_32, R_M68HC11_32},
  {BFD_RELOC_M68HC11_3B, R_M68HC11_3B},

  {BFD_RELOC_VTABLE_INHERIT, R_M68HC11_GNU_VTINHERIT},
  {BFD_RELOC_VTABLE_ENTRY, R_M68HC11_GNU_VTENTRY},

  {BFD_RELOC_M68HC11_LO16, R_M68HC11_LO16},
  {BFD_RELOC_M68HC11_PAGE, R_M68HC11_PAGE},
  {BFD_RELOC_M68HC11_24, R_M68HC11_24},

  {BFD_RELOC_M68HC11_RL_JUMP, R_M68HC11_RL_JUMP},
  {BFD_RELOC_M68HC11_RL_GROUP, R_M68HC11_RL_GROUP},
}

Definition at line 371 of file elf32-m68hc12.c.