aboutsummaryrefslogtreecommitdiff
path: root/bfd/oasys.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-11-29 22:05:37 +0000
committerIan Lance Taylor <ian@airs.com>1995-11-29 22:05:37 +0000
commita9713b91a74c2cc05db65ec58573f388d2c41cc0 (patch)
treec786fa623034d37112d9290b9380d06ff0c36a5c /bfd/oasys.c
parent8f2bdc203241c910f5ddd969a5ebb5f7199f7edd (diff)
downloadgdb-a9713b91a74c2cc05db65ec58573f388d2c41cc0.zip
gdb-a9713b91a74c2cc05db65ec58573f388d2c41cc0.tar.gz
gdb-a9713b91a74c2cc05db65ec58573f388d2c41cc0.tar.bz2
* opncls.c (bfd_alloc_by_size_t): Set bfd_error_no_memory if
obstack_alloc fails. (bfd_alloc_finish): Set bfd_error_no_memory if obstack_finish fails. * libbfd.c (bfd_zmalloc): Set bfd_error_no_memory if malloc fails. * Many files: don't set bfd_error_no_memory if one of the above routines fails.
Diffstat (limited to 'bfd/oasys.c')
-rw-r--r--bfd/oasys.c58
1 files changed, 14 insertions, 44 deletions
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 7637064..71dee97 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -118,10 +118,7 @@ oasys_slurp_symbol_table (abfd)
data->strings = bfd_alloc (abfd, data->symbol_string_length);
#endif
if (!data->symbols || !data->strings)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
dest_defined = data->symbols + abfd->symcount - 1;
@@ -310,10 +307,7 @@ oasys_archive_p (abfd)
oasys_module_table_type record;
if (!ar || !module)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
+ return NULL;
abfd->tdata.oasys_ar_data = ar;
ar->module = module;
@@ -343,10 +337,7 @@ oasys_archive_p (abfd)
module[i].name = bfd_alloc (abfd, 33);
if (!module[i].name)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
+ return NULL;
memcpy (module[i].name, record_ext.mod_name, 33);
filepos +=
@@ -372,10 +363,7 @@ oasys_archive_p (abfd)
module[i].name = bfd_alloc (abfd, record.module_name_size + 1);
if (!module[i].name)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
+ return NULL;
if (bfd_read ((PTR) module[i].name, 1, record.module_name_size,
abfd)
!= record.module_name_size)
@@ -462,10 +450,7 @@ oasys_object_p (abfd)
}
buffer = bfd_alloc (abfd, 3);
if (!buffer)
- {
- bfd_set_error (bfd_error_no_memory);
- goto fail;
- }
+ goto fail;
section_number = record.section.relb & RELOCATION_SECT_BITS;
sprintf (buffer, "%u", section_number);
s = bfd_make_section (abfd, buffer);
@@ -633,10 +618,7 @@ oasys_slurp_section_data (abfd)
{
per->data = (bfd_byte *) bfd_zalloc (abfd, section->_raw_size);
if (!per->data)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
per->reloc_tail_ptr = (oasys_reloc_type **) & (section->relocation);
per->had_vma = false;
per->initialized = true;
@@ -703,10 +685,7 @@ oasys_slurp_section_data (abfd)
bfd_alloc (abfd,
sizeof (oasys_reloc_type));
if (!r)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
*(per->reloc_tail_ptr) = r;
per->reloc_tail_ptr = &r->next;
r->next = (oasys_reloc_type *) NULL;
@@ -750,10 +729,7 @@ oasys_slurp_section_data (abfd)
bfd_alloc (abfd,
sizeof (oasys_reloc_type));
if (!r)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
*(per->reloc_tail_ptr) = r;
per->reloc_tail_ptr = &r->next;
r->next = (oasys_reloc_type *) NULL;
@@ -819,10 +795,7 @@ oasys_new_section_hook (abfd, newsect)
newsect->used_by_bfd = (PTR)
bfd_alloc (abfd, sizeof (oasys_per_section_type));
if (!newsect->used_by_bfd)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
oasys_per_section (newsect)->data = (bfd_byte *) NULL;
oasys_per_section (newsect)->section = newsect;
oasys_per_section (newsect)->offset = 0;
@@ -1038,6 +1011,9 @@ oasys_write_sections (abfd)
{
if (!isdigit (s->name[0]))
{
+ (*_bfd_error_handler)
+ ("%s: can not represent section `%s' in oasys",
+ bfd_get_filename (abfd), s->name);
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
}
@@ -1345,10 +1321,7 @@ oasys_set_section_contents (abfd, section, location, offset, count)
oasys_per_section (section)->data =
(bfd_byte *) (bfd_alloc (abfd, section->_cooked_size));
if (!oasys_per_section (section)->data)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
+ return false;
}
(void) memcpy ((PTR) (oasys_per_section (section)->data + offset),
location,
@@ -1373,10 +1346,7 @@ oasys_make_empty_symbol (abfd)
oasys_symbol_type *new =
(oasys_symbol_type *) bfd_zalloc (abfd, sizeof (oasys_symbol_type));
if (!new)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
+ return NULL;
new->symbol.the_bfd = abfd;
return &new->symbol;
}