strindex does not run us past the end, but right now we
don't know the length of the string table. */
strings += strindex;
- name = bfd_alloc (abfd, (bfd_size_type) strlen (strings) + 1);
+ name = (char *) bfd_alloc (abfd,
+ (bfd_size_type) strlen (strings) + 1);
if (name == NULL)
return FALSE;
strcpy (name, strings);
if (name == NULL)
{
/* Assorted wastage to null-terminate the name, thanks AT&T! */
- name = bfd_alloc (abfd, (bfd_size_type) sizeof (hdr->s_name) + 1);
+ name = (char *) bfd_alloc (abfd,
+ (bfd_size_type) sizeof (hdr->s_name) + 1);
if (name == NULL)
return FALSE;
strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
scnhsz = bfd_coff_scnhsz (abfd);
readsize = (bfd_size_type) nscns * scnhsz;
- external_sections = bfd_alloc (abfd, readsize);
+ external_sections = (char *) bfd_alloc (abfd, readsize);
if (!external_sections)
goto fail;
/* Get the BFD section from a COFF symbol section number. */
asection *
-coff_section_from_bfd_index (bfd *abfd, int index)
+coff_section_from_bfd_index (bfd *abfd, int section_index)
{
struct bfd_section *answer = abfd->sections;
- if (index == N_ABS)
+ if (section_index == N_ABS)
return bfd_abs_section_ptr;
- if (index == N_UNDEF)
+ if (section_index == N_UNDEF)
return bfd_und_section_ptr;
- if (index == N_DEBUG)
+ if (section_index == N_DEBUG)
return bfd_abs_section_ptr;
while (answer)
{
- if (answer->target_index == index)
+ if (answer->target_index == section_index)
return answer;
answer = answer->next;
}
amt = sec->reloc_count * relsz;
if (external_relocs == NULL)
{
- free_external = bfd_malloc (amt);
+ free_external = (bfd_byte *) bfd_malloc (amt);
if (free_external == NULL)
goto error_return;
external_relocs = free_external;
{
amt = sec->reloc_count;
amt *= sizeof (struct internal_reloc);
- free_internal = bfd_malloc (amt);
+ free_internal = (struct internal_reloc *) bfd_malloc (amt);
if (free_internal == NULL)
goto error_return;
internal_relocs = free_internal;
bfd_size_type amt;
amt = sizeof (asymbol *) * ((bfd_size_type) symbol_count + 1);
- newsyms = bfd_alloc (bfd_ptr, amt);
+ newsyms = (asymbol **) bfd_alloc (bfd_ptr, amt);
if (!newsyms)
return FALSE;
bfd_ptr->outsymbols = newsyms;
{
unsigned int numaux = native->u.syment.n_numaux;
int type = native->u.syment.n_type;
- int n_sclass = native->u.syment.n_sclass;
+ int n_sclass = (int) native->u.syment.n_sclass;
void * buf;
bfd_size_type symesz;
}
sec_size = sect->size;
- debug_section = bfd_alloc (abfd, sec_size);
+ debug_section = (char *) bfd_alloc (abfd, sec_size);
if (debug_section == NULL)
return NULL;
if (name[len] == '\0')
break;
- if ((newname = bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
+ if ((newname = (char *) bfd_alloc (abfd, (bfd_size_type) len + 1)) == NULL)
return NULL;
strncpy (newname, name, len);
return NULL;
}
- strings = bfd_malloc (strsize);
+ strings = (char *) bfd_malloc (strsize);
if (strings == NULL)
return NULL;
return obj_raw_syments (abfd);
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
- internal = bfd_zalloc (abfd, size);
+ internal = (combined_entry_type *) bfd_zalloc (abfd, size);
if (internal == NULL && size != 0)
return NULL;
internal_end = internal + obj_raw_syment_count (abfd);
if (internal_ptr->u.syment._n._n_name[i] == '\0')
break;
- newstring = bfd_zalloc (abfd, (bfd_size_type) (i + 1));
+ newstring = (char *) bfd_zalloc (abfd, (bfd_size_type) (i + 1));
if (newstring == NULL)
return NULL;
strncpy (newstring, internal_ptr->u.syment._n._n_name, i);
maxdiff = (bfd_vma) 0 - (bfd_vma) 1;
while (1)
{
+ bfd_vma file_addr;
combined_entry_type *p2;
for (p2 = p + 1 + p->u.syment.n_numaux;
}
}
+ file_addr = (bfd_vma) p2->u.syment.n_value;
+ /* PR 11512: Include the section address of the function name symbol. */
+ if (p2->u.syment.n_scnum > 0)
+ file_addr += coff_section_from_bfd_index (abfd,
+ p2->u.syment.n_scnum)->vma;
/* We use <= MAXDIFF here so that if we get a zero length
file, we actually use the next file entry. */
if (p2 < pend
- && offset + sec_vma >= (bfd_vma) p2->u.syment.n_value
- && offset + sec_vma - (bfd_vma) p2->u.syment.n_value <= maxdiff)
+ && offset + sec_vma >= file_addr
+ && offset + sec_vma - file_addr <= maxdiff)
{
*filename_ptr = (char *) p->u.syment._n._n_n._n_offset;
maxdiff = offset + sec_vma - p2->u.syment.n_value;
combined_entry_type * native;
bfd_size_type amt = sizeof (* native);
- native = bfd_zalloc (abfd, amt);
+ native = (combined_entry_type *) bfd_zalloc (abfd, amt);
if (native == NULL)
return FALSE;