Line 1... |
Line 1... |
/* Stabs in sections linking support.
|
/* Stabs in sections linking support.
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
2006, 2007 Free Software Foundation, Inc.
|
2006, 2007, 2008 Free Software Foundation, Inc.
|
Written by Ian Lance Taylor, Cygnus Support.
|
Written by Ian Lance Taylor, Cygnus Support.
|
|
|
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 125... |
Line 125... |
(struct stab_link_includes_entry *) entry;
|
(struct stab_link_includes_entry *) entry;
|
|
|
/* 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 (ret == NULL)
|
if (ret == NULL)
|
ret = bfd_hash_allocate (table,
|
ret = (struct stab_link_includes_entry *)
|
sizeof (struct stab_link_includes_entry));
|
bfd_hash_allocate (table, sizeof (struct stab_link_includes_entry));
|
if (ret == NULL)
|
if (ret == NULL)
|
return NULL;
|
return NULL;
|
|
|
/* Call the allocation method of the superclass. */
|
/* Call the allocation method of the superclass. */
|
ret = ((struct stab_link_includes_entry *)
|
ret = ((struct stab_link_includes_entry *)
|
Line 335... |
Line 335... |
for (; *str != '\0'; str++)
|
for (; *str != '\0'; str++)
|
{
|
{
|
if (num_chars >= buf_len)
|
if (num_chars >= buf_len)
|
{
|
{
|
buf_len += 32 * 1024;
|
buf_len += 32 * 1024;
|
symb = bfd_realloc_or_free (symb, buf_len);
|
symb = (char *) bfd_realloc_or_free (symb, buf_len);
|
if (symb == NULL)
|
if (symb == NULL)
|
goto error_return;
|
goto error_return;
|
symb_rover = symb + num_chars;
|
symb_rover = symb + num_chars;
|
}
|
}
|
* symb_rover ++ = * str;
|
* symb_rover ++ = * str;
|
Line 373... |
Line 373... |
break;
|
break;
|
|
|
/* Record this symbol, so that we can set the value
|
/* Record this symbol, so that we can set the value
|
correctly. */
|
correctly. */
|
amt = sizeof *ne;
|
amt = sizeof *ne;
|
ne = bfd_alloc (abfd, amt);
|
ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
|
if (ne == NULL)
|
if (ne == NULL)
|
goto error_return;
|
goto error_return;
|
ne->offset = sym - stabbuf;
|
ne->offset = sym - stabbuf;
|
ne->val = sum_chars;
|
ne->val = sum_chars;
|
ne->type = (int) N_BINCL;
|
ne->type = (int) N_BINCL;
|
Line 386... |
Line 386... |
|
|
if (t == NULL)
|
if (t == NULL)
|
{
|
{
|
/* This is the first time we have seen this header file
|
/* This is the first time we have seen this header file
|
with this set of stabs strings. */
|
with this set of stabs strings. */
|
t = bfd_hash_allocate (&sinfo->includes, sizeof *t);
|
t = (struct stab_link_includes_totals *)
|
|
bfd_hash_allocate (&sinfo->includes, sizeof *t);
|
if (t == NULL)
|
if (t == NULL)
|
goto error_return;
|
goto error_return;
|
t->sum_chars = sum_chars;
|
t->sum_chars = sum_chars;
|
t->num_chars = num_chars;
|
t->num_chars = num_chars;
|
t->symb = symb = bfd_realloc_or_free (symb, num_chars); /* Trim data down. */
|
/* Trim data down. */
|
|
t->symb = symb = (char *) bfd_realloc_or_free (symb, num_chars);
|
t->next = incl_entry->totals;
|
t->next = incl_entry->totals;
|
incl_entry->totals = t;
|
incl_entry->totals = t;
|
}
|
}
|
else
|
else
|
{
|
{
|
Line 469... |
Line 471... |
{
|
{
|
bfd_size_type i, offset;
|
bfd_size_type i, offset;
|
bfd_size_type *pskips;
|
bfd_size_type *pskips;
|
|
|
amt = count * sizeof (bfd_size_type);
|
amt = count * sizeof (bfd_size_type);
|
secinfo->cumulative_skips = bfd_alloc (abfd, amt);
|
secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
|
if (secinfo->cumulative_skips == NULL)
|
if (secinfo->cumulative_skips == NULL)
|
goto error_return;
|
goto error_return;
|
|
|
pskips = secinfo->cumulative_skips;
|
pskips = secinfo->cumulative_skips;
|
pstridx = secinfo->stridxs;
|
pstridx = secinfo->stridxs;
|
Line 622... |
Line 624... |
bfd_size_type *pskips;
|
bfd_size_type *pskips;
|
|
|
if (secinfo->cumulative_skips == NULL)
|
if (secinfo->cumulative_skips == NULL)
|
{
|
{
|
amt = count * sizeof (bfd_size_type);
|
amt = count * sizeof (bfd_size_type);
|
secinfo->cumulative_skips = bfd_alloc (abfd, amt);
|
secinfo->cumulative_skips = (bfd_size_type *) bfd_alloc (abfd, amt);
|
if (secinfo->cumulative_skips == NULL)
|
if (secinfo->cumulative_skips == NULL)
|
goto error_return;
|
goto error_return;
|
}
|
}
|
|
|
pskips = secinfo->cumulative_skips;
|
pskips = secinfo->cumulative_skips;
|