aboutsummaryrefslogtreecommitdiff
path: root/bfd/evax-misc.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-08-08 16:27:21 +0000
committerIan Lance Taylor <ian@airs.com>1996-08-08 16:27:21 +0000
commit8612a388f71b8a34a4f118a1f9e5ca660342d7cf (patch)
tree8e5c2366446f0297c15524df542e107509c7f635 /bfd/evax-misc.c
parent9e8419d04303bfddb2b062f70ef70541a7f14a10 (diff)
downloadgdb-8612a388f71b8a34a4f118a1f9e5ca660342d7cf.zip
gdb-8612a388f71b8a34a4f118a1f9e5ca660342d7cf.tar.gz
gdb-8612a388f71b8a34a4f118a1f9e5ca660342d7cf.tar.bz2
Thu Aug 8 12:21:56 1996 Klaus Kaempf <kkaempf@progis.de>
* evax-alpha.c (evax_alpha_vec): Corrected flags, cleanup. (evax_initialize): Remove evax_reloc_table. (evax_close_and_cleanup): Ditto. (reloc_nil): Ditto. (alpha_howto_table): Remove ALPHA_R_SWREL32 and ALPHA_R_SWREL64 entries. (evax_bfd_reloc_type_lookup): Ditto. * evax-egsd.c (_bfd_evax_slurp_egsd): Add a few casts; set cooked_size == raw_size. * evax-emh.c (_bfd_evax_register_filename): Remove. * evax-etir.c (etir_stc): Allow ETIR_S_C_STC_xx commands. * evax-misc.c (add_new_contents): Malloc section at full size. (_bfd_save_evax_section): Memcpy section contents directly. * evax.h (ALPHA_R_SWREL32, ALPHA_R_SWREL64): Remove. (evax_reloc_table): Remove. * hosts/alphavms.h (O_ACCMODE): Define if needed. * makefile.vms: Add better support for DEC C compilation Add evax.h dependencies * reloc.c (bfd_get_reloc_size): Add case for 16 byte reloc. (BFD_RELOC_SWREL32,BFD_RELOC_SWREL64): Remove. (BFD_RELOC_ALPHA_BASEREG): Remove. * bfd-in2.h, libbfd.h: Rebuild.
Diffstat (limited to 'bfd/evax-misc.c')
-rw-r--r--bfd/evax-misc.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/bfd/evax-misc.c b/bfd/evax-misc.c
index aade68a..3da8999 100644
--- a/bfd/evax-misc.c
+++ b/bfd/evax-misc.c
@@ -558,23 +558,20 @@ add_new_contents (abfd, section)
{
evax_section *sptr, *newptr;
- newptr = (evax_section *) bfd_zalloc (abfd, sizeof (evax_section));
- if (newptr == (evax_section *)NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return NULL;
- }
sptr = PRIV(evax_section_table)[section->index];
- if (sptr == NULL)
- {
- PRIV(evax_section_table)[section->index] = (evax_section *)newptr;
- }
- else
- {
- while (sptr->next != NULL)
- sptr = sptr->next;
- sptr->next = newptr;
- }
+ if (sptr != NULL)
+ return sptr;
+
+ newptr = (evax_section *) bfd_malloc (sizeof (evax_section));
+ if (newptr == (evax_section *) NULL)
+ return NULL;
+ newptr->contents = (unsigned char *) bfd_alloc (abfd, section->_raw_size);
+ if (newptr->contents == (unsigned char *)NULL)
+ return NULL;
+ newptr->offset = 0;
+ newptr->size = section->_raw_size;
+ newptr->next = 0;
+ PRIV(evax_section_table)[section->index] = newptr;
return newptr;
}
@@ -602,20 +599,7 @@ _bfd_save_evax_section (abfd, section, data, offset, count)
sptr = add_new_contents (abfd, section);
if (sptr == NULL)
return false;
- sptr->contents = (unsigned char *) bfd_alloc (abfd, (int)count);
- if (sptr->contents == (unsigned char *)NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return false;
- }
- memcpy (sptr->contents, data, (int)count);
- sptr->offset = (bfd_vma)offset;
- sptr->size = count;
-
-#if EVAX_DEBUG
- evax_debug (6, "_bfd_save_evax_section sptr = %08lx\n", sptr);
- _bfd_hexdump (6, data, count, (int)offset);
-#endif
+ memcpy (sptr->contents + offset, data, (size_t) count);
return true;
}