/* SEC_MERGE support.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
This file is part of BFD, the Binary File Descriptor library.
|| (sec->flags & SEC_MERGE) == 0)
abort ();
- if (sec->_raw_size == 0
+ if (sec->size == 0
|| (sec->flags & SEC_EXCLUDE) != 0
|| sec->entsize == 0)
return TRUE;
/* Read the section from abfd. */
- amt = sizeof (struct sec_merge_sec_info) + sec->_raw_size - 1;
+ amt = sizeof (struct sec_merge_sec_info) + sec->size - 1;
*psecinfo = bfd_alloc (abfd, amt);
if (*psecinfo == NULL)
goto error_return;
secinfo->htab = sinfo->htab;
secinfo->first_str = NULL;
+ sec->rawsize = sec->size;
if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents,
- 0, sec->_raw_size))
+ 0, sec->size))
goto error_return;
return TRUE;
unsigned int align, i;
align = sec->alignment_power;
- end = secinfo->contents + sec->_raw_size;
+ end = secinfo->contents + sec->size;
nul = FALSE;
mask = ((bfd_vma) 1 << align) - 1;
if (sec->flags & SEC_STRINGS)
eltalign = ((eltalign ^ (eltalign - 1)) + 1) >> 1;
if (!eltalign || eltalign > mask)
eltalign = mask + 1;
- entry = sec_merge_add (sinfo->htab, p, (unsigned) eltalign, secinfo);
+ entry = sec_merge_add (sinfo->htab, (char *) p, (unsigned) eltalign,
+ secinfo);
if (! entry)
goto error_return;
p += entry->len;
if (!nul && !((p - secinfo->contents) & mask))
{
nul = TRUE;
- entry = sec_merge_add (sinfo->htab, p,
+ entry = sec_merge_add (sinfo->htab, (char *) p,
(unsigned) mask + 1, secinfo);
if (! entry)
goto error_return;
{
for (p = secinfo->contents; p < end; p += sec->entsize)
{
- entry = sec_merge_add (sinfo->htab, p, 1, secinfo);
+ entry = sec_merge_add (sinfo->htab, (char *) p, 1, secinfo);
if (! entry)
goto error_return;
}
struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b;
unsigned int lenA = A->len;
unsigned int lenB = B->len;
- const unsigned char *s = A->root.string + lenA - 1;
- const unsigned char *t = B->root.string + lenB - 1;
+ const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1;
+ const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1;
int l = lenA < lenB ? lenA : lenB;
while (l)
struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b;
unsigned int lenA = A->len;
unsigned int lenB = B->len;
- const unsigned char *s = A->root.string + lenA - 1;
- const unsigned char *t = B->root.string + lenB - 1;
+ const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1;
+ const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1;
int l = lenA < lenB ? lenA : lenB;
int tail_align = (lenA & (A->alignment - 1)) - (lenB & (A->alignment - 1));
{
if (e->secinfo != secinfo)
{
- secinfo->sec->_cooked_size = size;
+ secinfo->sec->size = size;
secinfo = e->secinfo;
}
if (e->alignment)
size += e->len;
}
}
- secinfo->sec->_cooked_size = size;
+ secinfo->sec->size = size;
/* And now adjust the rest, removing them from the chain (but not hashtable)
at the same time. */
if (e->secinfo->first_str == NULL)
{
if (secinfo)
- secinfo->sec->_cooked_size = size;
+ secinfo->sec->size = size;
e->secinfo->first_str = e;
size = 0;
}
size += e->len;
secinfo = e->secinfo;
}
- secinfo->sec->_cooked_size = size;
+ secinfo->sec->size = size;
}
/* Finally remove all input sections which have not made it into
secinfo = (struct sec_merge_sec_info *) psecinfo;
- if (offset >= sec->_raw_size)
+ if (offset >= sec->rawsize)
{
- if (offset > sec->_raw_size)
+ if (offset > sec->rawsize)
{
(*_bfd_error_handler)
(_("%s: access beyond end of merged section (%ld)"),
bfd_get_filename (sec->owner), (long) offset);
}
- return (secinfo->first_str ? sec->_cooked_size : 0);
+ return secinfo->first_str ? sec->size : 0;
}
if (secinfo->htab->strings)
{
p = secinfo->contents + (offset / sec->entsize) * sec->entsize;
}
- entry = sec_merge_hash_lookup (secinfo->htab, p, 0, FALSE);
+ entry = sec_merge_hash_lookup (secinfo->htab, (char *) p, 0, FALSE);
if (!entry)
{
if (! secinfo->htab->strings)