OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 157 Rev 225
Line 1... Line 1...
/* SEC_MERGE support.
/* SEC_MERGE support.
   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007
   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
   Written by Jakub Jelinek <jakub@redhat.com>.
   Written by Jakub Jelinek <jakub@redhat.com>.
 
 
   This file is part of BFD, the Binary File Descriptor library.
   This file is part of BFD, the Binary File Descriptor library.
 
 
Line 106... Line 106...
                        struct bfd_hash_table *table, const char *string)
                        struct bfd_hash_table *table, const char *string)
{
{
  /* Allocate the structure if it has not already been allocated by a
  /* Allocate the structure if it has not already been allocated by a
     subclass.  */
     subclass.  */
  if (entry == NULL)
  if (entry == NULL)
    entry = bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry));
    entry = (struct bfd_hash_entry *)
 
        bfd_hash_allocate (table, sizeof (struct sec_merge_hash_entry));
  if (entry == NULL)
  if (entry == NULL)
    return NULL;
    return NULL;
 
 
  /* Call the allocation method of the superclass.  */
  /* Call the allocation method of the superclass.  */
  entry = bfd_hash_newfunc (entry, table, string);
  entry = bfd_hash_newfunc (entry, table, string);
Line 233... Line 234...
static struct sec_merge_hash *
static struct sec_merge_hash *
sec_merge_init (unsigned int entsize, bfd_boolean strings)
sec_merge_init (unsigned int entsize, bfd_boolean strings)
{
{
  struct sec_merge_hash *table;
  struct sec_merge_hash *table;
 
 
  table = bfd_malloc (sizeof (struct sec_merge_hash));
  table = (struct sec_merge_hash *) bfd_malloc (sizeof (struct sec_merge_hash));
  if (table == NULL)
  if (table == NULL)
    return NULL;
    return NULL;
 
 
  if (! bfd_hash_table_init_n (&table->table, sec_merge_hash_newfunc,
  if (! bfd_hash_table_init_n (&table->table, sec_merge_hash_newfunc,
                               sizeof (struct sec_merge_hash_entry), 16699))
                               sizeof (struct sec_merge_hash_entry), 16699))
Line 291... Line 292...
  bfd_size_type off = 0;
  bfd_size_type off = 0;
  int alignment_power = sec->output_section->alignment_power;
  int alignment_power = sec->output_section->alignment_power;
 
 
  if (alignment_power)
  if (alignment_power)
    {
    {
      pad = bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
      pad = (char *) bfd_zmalloc ((bfd_size_type) 1 << alignment_power);
      if (pad == NULL)
      if (pad == NULL)
        return FALSE;
        return FALSE;
    }
    }
 
 
  for (; entry != NULL && entry->secinfo == secinfo; entry = entry->next)
  for (; entry != NULL && entry->secinfo == secinfo; entry = entry->next)
Line 388... Line 389...
      break;
      break;
 
 
  if (sinfo == NULL)
  if (sinfo == NULL)
    {
    {
      /* Initialize the information we need to keep track of.  */
      /* Initialize the information we need to keep track of.  */
      sinfo = bfd_alloc (abfd, sizeof (struct sec_merge_info));
      sinfo = (struct sec_merge_info *)
 
          bfd_alloc (abfd, sizeof (struct sec_merge_info));
      if (sinfo == NULL)
      if (sinfo == NULL)
        goto error_return;
        goto error_return;
      sinfo->next = (struct sec_merge_info *) *psinfo;
      sinfo->next = (struct sec_merge_info *) *psinfo;
      sinfo->chain = NULL;
      sinfo->chain = NULL;
      *psinfo = sinfo;
      *psinfo = sinfo;
Line 599... Line 601...
  bfd_size_type size, amt;
  bfd_size_type size, amt;
  unsigned int alignment = 0;
  unsigned int alignment = 0;
 
 
  /* Now sort the strings */
  /* Now sort the strings */
  amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
  amt = sinfo->htab->size * sizeof (struct sec_merge_hash_entry *);
  array = bfd_malloc (amt);
  array = (struct sec_merge_hash_entry **) bfd_malloc (amt);
  if (array == NULL)
  if (array == NULL)
    goto alloc_failure;
    goto alloc_failure;
 
 
  for (e = sinfo->htab->first, a = array; e; e = e->next)
  for (e = sinfo->htab->first, a = array; e; e = e->next)
    if (e->alignment)
    if (e->alignment)
Line 790... Line 792...
    return FALSE;
    return FALSE;
 
 
  if (secinfo->first_str == NULL)
  if (secinfo->first_str == NULL)
    return TRUE;
    return TRUE;
 
 
 
  /* FIXME: octets_per_byte.  */
  pos = sec->output_section->filepos + sec->output_offset;
  pos = sec->output_section->filepos + sec->output_offset;
  if (bfd_seek (output_bfd, pos, SEEK_SET) != 0)
  if (bfd_seek (output_bfd, pos, SEEK_SET) != 0)
    return FALSE;
    return FALSE;
 
 
  if (! sec_merge_emit (output_bfd, secinfo->first_str))
  if (! sec_merge_emit (output_bfd, secinfo->first_str))

powered by: WebSVN 2.1.0

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