OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [bfd/] [tekhex.c] - Diff between revs 157 and 225

Show entire file | Details | Blame | View Log

Rev 157 Rev 225
Line 1... Line 1...
/* BFD backend for Extended Tektronix Hex Format  objects.
/* BFD backend for Extended Tektronix Hex Format  objects.
   Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
   Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
   2003, 2004, 2007 Free Software Foundation, Inc.
   2003, 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
   Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
   Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
 
 
   This file is part of BFD, the Binary File Descriptor library.
   This file is part of BFD, the Binary File Descriptor library.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
Line 322... Line 322...
    d = d->next;
    d = d->next;
 
 
  if (!d)
  if (!d)
    {
    {
      /* No chunk for this address, so make one up.  */
      /* No chunk for this address, so make one up.  */
      d = bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct));
      d = (struct data_struct *)
 
          bfd_zalloc (abfd, (bfd_size_type) sizeof (struct data_struct));
 
 
      if (!d)
      if (!d)
        return NULL;
        return NULL;
 
 
      d->next = abfd->tdata.tekhex_data->data;
      d->next = abfd->tdata.tekhex_data->data;
Line 381... Line 382...
      if (!getsym (sym, &src, &len))
      if (!getsym (sym, &src, &len))
        return FALSE;
        return FALSE;
      section = bfd_get_section_by_name (abfd, sym);
      section = bfd_get_section_by_name (abfd, sym);
      if (section == NULL)
      if (section == NULL)
        {
        {
          char *n = bfd_alloc (abfd, (bfd_size_type) len + 1);
          char *n = (char *) bfd_alloc (abfd, (bfd_size_type) len + 1);
 
 
          if (!n)
          if (!n)
            return FALSE;
            return FALSE;
          memcpy (n, sym, len + 1);
          memcpy (n, sym, len + 1);
          section = bfd_make_section (abfd, n);
          section = bfd_make_section (abfd, n);
Line 413... Line 414...
            case '7':
            case '7':
            case '8':
            case '8':
              /* Symbols, add to section.  */
              /* Symbols, add to section.  */
              {
              {
                bfd_size_type amt = sizeof (tekhex_symbol_type);
                bfd_size_type amt = sizeof (tekhex_symbol_type);
                tekhex_symbol_type *new = bfd_alloc (abfd, amt);
                tekhex_symbol_type *new_symbol = (tekhex_symbol_type *)
 
                    bfd_alloc (abfd, amt);
                char stype = (*src);
                char stype = (*src);
 
 
                if (!new)
                if (!new_symbol)
                  return FALSE;
                  return FALSE;
                new->symbol.the_bfd = abfd;
                new_symbol->symbol.the_bfd = abfd;
                src++;
                src++;
                abfd->symcount++;
                abfd->symcount++;
                abfd->flags |= HAS_SYMS;
                abfd->flags |= HAS_SYMS;
                new->prev = abfd->tdata.tekhex_data->symbols;
                new_symbol->prev = abfd->tdata.tekhex_data->symbols;
                abfd->tdata.tekhex_data->symbols = new;
                abfd->tdata.tekhex_data->symbols = new_symbol;
                if (!getsym (sym, &src, &len))
                if (!getsym (sym, &src, &len))
                  return FALSE;
                  return FALSE;
                new->symbol.name = bfd_alloc (abfd, (bfd_size_type) len + 1);
                new_symbol->symbol.name = (const char *)
                if (!new->symbol.name)
                    bfd_alloc (abfd, (bfd_size_type) len + 1);
 
                if (!new_symbol->symbol.name)
                  return FALSE;
                  return FALSE;
                memcpy ((char *) (new->symbol.name), sym, len + 1);
                memcpy ((char *) (new_symbol->symbol.name), sym, len + 1);
                new->symbol.section = section;
                new_symbol->symbol.section = section;
                if (stype <= '4')
                if (stype <= '4')
                  new->symbol.flags = (BSF_GLOBAL | BSF_EXPORT);
                  new_symbol->symbol.flags = (BSF_GLOBAL | BSF_EXPORT);
                else
                else
                  new->symbol.flags = BSF_LOCAL;
                  new_symbol->symbol.flags = BSF_LOCAL;
                if (!getvalue (&src, &val))
                if (!getvalue (&src, &val))
                  return FALSE;
                  return FALSE;
                new->symbol.value = val - section->vma;
                new_symbol->symbol.value = val - section->vma;
                break;
                break;
              }
              }
            default:
            default:
              return FALSE;
              return FALSE;
            }
            }
Line 530... Line 533...
static bfd_boolean
static bfd_boolean
tekhex_mkobject (bfd *abfd)
tekhex_mkobject (bfd *abfd)
{
{
  tdata_type *tdata;
  tdata_type *tdata;
 
 
  tdata = bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
  tdata = (tdata_type *) bfd_alloc (abfd, (bfd_size_type) sizeof (tdata_type));
  if (!tdata)
  if (!tdata)
    return FALSE;
    return FALSE;
  abfd->tdata.tekhex_data = tdata;
  abfd->tdata.tekhex_data = tdata;
  tdata->type = 1;
  tdata->type = 1;
  tdata->head =  NULL;
  tdata->head =  NULL;
Line 878... Line 881...
 
 
static asymbol *
static asymbol *
tekhex_make_empty_symbol (bfd *abfd)
tekhex_make_empty_symbol (bfd *abfd)
{
{
  bfd_size_type amt = sizeof (struct tekhex_symbol_struct);
  bfd_size_type amt = sizeof (struct tekhex_symbol_struct);
  tekhex_symbol_type *new = bfd_zalloc (abfd, amt);
  tekhex_symbol_type *new_symbol = (tekhex_symbol_type *) bfd_zalloc (abfd,
 
                                                                      amt);
 
 
  if (!new)
  if (!new_symbol)
    return NULL;
    return NULL;
  new->symbol.the_bfd = abfd;
  new_symbol->symbol.the_bfd = abfd;
  new->prev =  NULL;
  new_symbol->prev =  NULL;
  return &(new->symbol);
  return &(new_symbol->symbol);
}
}
 
 
static void
static void
tekhex_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
tekhex_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
                        asymbol *symbol,
                        asymbol *symbol,
Line 941... Line 945...
#define tekhex_bfd_gc_sections                      bfd_generic_gc_sections
#define tekhex_bfd_gc_sections                      bfd_generic_gc_sections
#define tekhex_bfd_merge_sections                   bfd_generic_merge_sections
#define tekhex_bfd_merge_sections                   bfd_generic_merge_sections
#define tekhex_bfd_is_group_section                 bfd_generic_is_group_section
#define tekhex_bfd_is_group_section                 bfd_generic_is_group_section
#define tekhex_bfd_discard_group                    bfd_generic_discard_group
#define tekhex_bfd_discard_group                    bfd_generic_discard_group
#define tekhex_section_already_linked               _bfd_generic_section_already_linked
#define tekhex_section_already_linked               _bfd_generic_section_already_linked
 
#define tekhex_bfd_define_common_symbol             bfd_generic_define_common_symbol
#define tekhex_bfd_link_hash_table_create           _bfd_generic_link_hash_table_create
#define tekhex_bfd_link_hash_table_create           _bfd_generic_link_hash_table_create
#define tekhex_bfd_link_hash_table_free             _bfd_generic_link_hash_table_free
#define tekhex_bfd_link_hash_table_free             _bfd_generic_link_hash_table_free
#define tekhex_bfd_link_add_symbols                 _bfd_generic_link_add_symbols
#define tekhex_bfd_link_add_symbols                 _bfd_generic_link_add_symbols
#define tekhex_bfd_link_just_syms                   _bfd_generic_link_just_syms
#define tekhex_bfd_link_just_syms                   _bfd_generic_link_just_syms
#define tekhex_bfd_final_link                       _bfd_generic_final_link
#define tekhex_bfd_final_link                       _bfd_generic_final_link

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.