/* Assorted wastage to null-terminate the name, thanks AT&T! */
name = bfd_alloc (abfd, sizeof (hdr->s_name) + 1);
if (name == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name));
name[sizeof (hdr->s_name)] = 0;
if (return_section == NULL)
return false;
- /* s_paddr is presumed to be = to s_vaddr */
-
return_section->vma = hdr->s_vaddr;
- return_section->lma = return_section->vma;
+ return_section->lma = hdr->s_paddr;
return_section->_raw_size = hdr->s_size;
return_section->filepos = hdr->s_scnptr;
return_section->rel_filepos = hdr->s_relptr;
readsize = nscns * scnhsz;
external_sections = (char *) bfd_alloc (abfd, readsize);
if (!external_sections)
- {
- bfd_set_error (bfd_error_no_memory);
- goto fail;
- }
+ goto fail;
if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
goto fail;
if (external_relocs == NULL)
{
- free_external = (bfd_byte *) malloc (sec->reloc_count * relsz);
+ free_external = (bfd_byte *) bfd_malloc (sec->reloc_count * relsz);
if (free_external == NULL && sec->reloc_count > 0)
- {
- bfd_set_error (bfd_error_no_memory);
- goto error_return;
- }
+ goto error_return;
external_relocs = free_external;
}
if (internal_relocs == NULL)
{
free_internal = ((struct internal_reloc *)
- malloc (sec->reloc_count
- * sizeof (struct internal_reloc)));
+ bfd_malloc (sec->reloc_count
+ * sizeof (struct internal_reloc)));
if (free_internal == NULL && sec->reloc_count > 0)
- {
- bfd_set_error (bfd_error_no_memory);
- goto error_return;
- }
+ goto error_return;
internal_relocs = free_internal;
}
(PTR) bfd_zalloc (abfd,
sizeof (struct coff_section_tdata));
if (sec->used_by_bfd == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- goto error_return;
- }
+ goto error_return;
coff_section_data (abfd, sec)->contents = NULL;
}
coff_section_data (abfd, sec)->relocs = free_internal;
sizeof (asymbol *)
* (symbol_count + 1));
if (!newsyms)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
bfd_ptr->outsymbols = newsyms;
for (i = 0; i < symbol_count; i++)
if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) != 0
symesz = bfd_coff_symesz (abfd);
buf = bfd_alloc (abfd, symesz);
if (!buf)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
bfd_coff_swap_sym_out (abfd, &native->u.syment, buf);
if (bfd_write (buf, 1, symesz, abfd) != symesz)
return false;
auxesz = bfd_coff_auxesz (abfd);
buf = bfd_alloc (abfd, auxesz);
if (!buf)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
for (j = 0; j < native->u.syment.n_numaux; j++)
{
bfd_coff_swap_aux_out (abfd,
linesz = bfd_coff_linesz (abfd);
buff = bfd_alloc (abfd, linesz);
if (!buff)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
for (s = abfd->sections; s != (asection *) NULL; s = s->next)
{
if (s->lineno_count)
debug_section = (PTR) bfd_alloc (abfd,
bfd_get_section_size_before_reloc (sect));
if (debug_section == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
+ return NULL;
/* Seek to the beginning of the `.debug' section and read it.
Save the current position first; it is needed by our caller.
}
if ((newname = (PTR) bfd_alloc (abfd, len + 1)) == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return (NULL);
- }
+ return (NULL);
strncpy (newname, name, len);
newname[len] = '\0';
return newname;
size = obj_raw_syment_count (abfd) * symesz;
- syms = (PTR) malloc (size);
+ syms = (PTR) bfd_malloc (size);
if (syms == NULL && size != 0)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
|| bfd_read (syms, size, 1, abfd) != size)
return NULL;
}
- strings = (char *) malloc (strsize);
+ strings = (char *) bfd_malloc (strsize);
if (strings == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
+ return NULL;
if (bfd_read (strings + STRING_SIZE_SIZE,
strsize - STRING_SIZE_SIZE, 1, abfd)
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type);
internal = (combined_entry_type *) bfd_alloc (abfd, size);
if (internal == NULL && size != 0)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
+ return NULL;
internal_end = internal + obj_raw_syment_count (abfd);
if (! _bfd_coff_get_external_symbols (abfd))
} /* possible lengths of this string. */
if ((newstring = (PTR) bfd_alloc (abfd, ++i)) == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return (NULL);
- } /* on error */
+ return (NULL);
memset (newstring, 0, i);
strncpy (newstring, internal_ptr->u.syment._n._n_name, i - 1);
internal_ptr->u.syment._n._n_n._n_offset = (long int) newstring;
{
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
if (new == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return (NULL);
- } /* on error */
+ return (NULL);
memset (new, 0, sizeof *new);
new->symbol.section = 0;
new->native = 0;
{
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
if (new == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return (NULL);
- } /* on error */
+ return (NULL);
/* @@ This shouldn't be using a constant multiplier. */
new->native = (combined_entry_type *) bfd_zalloc (abfd, sizeof (combined_entry_type) * 10);
if (!new->native)
- {
- bfd_set_error (bfd_error_no_memory);
- return (NULL);
- } /* on error */
+ return (NULL);
new->symbol.section = bfd_abs_section_ptr;
new->symbol.flags = BSF_DEBUGGING;
new->lineno = (alent *) NULL;
}
/* Cache the results for the next call. */
- if (sec_data == NULL)
+ if (sec_data == NULL && section->owner == abfd)
{
section->used_by_bfd =
((PTR) bfd_zalloc (abfd,