-
-\f
-/* object file output functions */
-
-/* GAS tends to write sections in little chunks (bfd_set_section_contents)
- which we can't use directly. So we save the little chunks in linked
- lists (one per section) and write them later. */
-
-/* Add a new vms_section structure to vms_section_table
- - forward chaining - */
-
-static vms_section *
-add_new_contents (abfd, section)
- bfd *abfd;
- sec_ptr section;
-{
- vms_section *sptr, *newptr;
-
- sptr = PRIV(vms_section_table)[section->index];
- if (sptr != NULL)
- return sptr;
-
- newptr = (vms_section *) bfd_malloc (sizeof (vms_section));
- if (newptr == (vms_section *) NULL)
- return NULL;
- newptr->contents = (unsigned char *) bfd_alloc (abfd, (int)section->_raw_size);
- if (newptr->contents == (unsigned char *)NULL)
- return NULL;
- newptr->offset = 0;
- newptr->size = section->_raw_size;
- newptr->next = 0;
- PRIV(vms_section_table)[section->index] = newptr;
- return newptr;
-}
-
-
-/* Save section data & offset to an vms_section structure
- vms_section_table[] holds the vms_section chain */
-
-boolean
-_bfd_save_vms_section (abfd, section, data, offset, count)
- bfd *abfd;
- sec_ptr section;
- PTR data;
- file_ptr offset;
- bfd_size_type count;
-{
- vms_section *sptr;
-
- if (section->index >= VMS_SECTION_COUNT)
- {
- bfd_set_error (bfd_error_nonrepresentable_section);
- return false;
- }
- if (count == (bfd_size_type)0)
- return true;
- sptr = add_new_contents (abfd, section);
- if (sptr == NULL)
- return false;
- memcpy (sptr->contents + offset, data, (size_t) count);
-
- return true;
-}
-
-
-/* Get vms_section pointer to saved contents for section # index */
-
-vms_section *
-_bfd_get_vms_section (abfd, index)
- bfd *abfd;
- int index;
-{
- if (index >= VMS_SECTION_COUNT)
- {
- bfd_set_error (bfd_error_nonrepresentable_section);
- return NULL;
- }
- return PRIV(vms_section_table)[index];
-}
-