- /* If this section isn't a bfd section. */
-
- if (PRIV(is_vax) && (psect_idx < (abfd->section_count-1)))
- {
- /* check for temporary section from TIR record. */
-
- if (psect_idx < PRIV(section_count))
- old_section = PRIV(sections)[psect_idx];
- else
- old_section = 0;
- }
-
- name = _bfd_vms_save_counted_string (vms_rec + 8);
- section = bfd_make_section (abfd, name);
- if (!section)
- {
- (*_bfd_error_handler) (_("bfd_make_section (%s) failed"),
- name);
- return -1;
- }
- old_flags = bfd_getl16 (vms_rec + 2);
- section->_raw_size = bfd_getl32 (vms_rec + 4); /* allocation */
- new_flags = vms_secflag_by_name (abfd, vax_section_flags, name,
- section->_raw_size > 0);
- if (old_flags & EGPS_S_V_REL)
- new_flags |= SEC_RELOC;
- if (old_flags & GPS_S_M_OVR)
- new_flags |= SEC_IS_COMMON;
- if (!bfd_set_section_flags (abfd, section, new_flags))
- {
- (*_bfd_error_handler)
- (_("bfd_set_section_flags (%s, %x) failed"),
- name, new_flags);
- return -1;
- }
- section->alignment_power = vms_rec[1];
- align_addr = (1 << section->alignment_power);
- if ((base_addr % align_addr) != 0)
- base_addr += (align_addr - (base_addr % align_addr));
- section->vma = (bfd_vma)base_addr;
- base_addr += section->_raw_size;
-
- /* global section is common symbol */
-
- if (old_flags & GPS_S_M_GBL)
- {
- entry = _bfd_vms_enter_symbol (abfd, name);
- if (entry == (vms_symbol_entry *)NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return -1;
- }
- symbol = entry->symbol;
-
- symbol->value = 0;
- symbol->section = section;
- symbol->flags = (BSF_GLOBAL|BSF_SECTION_SYM|BSF_OLD_COMMON);
- }
-
- /* copy saved contents if old_section set */
-
- if (old_section != 0)
- {
- section->contents = old_section->contents;
- if (section->_raw_size < old_section->_raw_size)
- {
- (*_bfd_error_handler)
- (_("Size mismatch section %s=%lx, %s=%lx"),
- old_section->name,
- (unsigned long) old_section->_raw_size,
- section->name,
- (unsigned long) section->_raw_size);
- return -1;
- }
- else if (section->_raw_size > old_section->_raw_size)
- {
- section->contents = ((unsigned char *)
- bfd_realloc (old_section->contents,
- section->_raw_size));
- if (section->contents == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return -1;
- }
- }
- }
- else
- {
- section->contents = ((unsigned char *)
- bfd_malloc (section->_raw_size));
- if (section->contents == NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- return -1;
- }
- memset (section->contents, 0, (size_t) section->_raw_size);
- }
- section->_cooked_size = section->_raw_size;
+ /* If this section isn't a bfd section. */
+ if (PRIV (is_vax) && (psect_idx < (abfd->section_count-1)))
+ {
+ /* Check for temporary section from TIR record. */
+ if (psect_idx < PRIV (section_count))
+ old_section = PRIV (sections)[psect_idx];
+ else
+ old_section = 0;
+ }
+
+ name = _bfd_vms_save_counted_string (vms_rec + 8);
+ section = bfd_make_section (abfd, name);
+ if (!section)
+ {
+ (*_bfd_error_handler) (_("bfd_make_section (%s) failed"),
+ name);
+ return -1;
+ }
+ old_flags = bfd_getl16 (vms_rec + 2);
+ section->size = bfd_getl32 (vms_rec + 4); /* allocation */
+ new_flags = vms_secflag_by_name (abfd, vax_section_flags, name,
+ section->size > 0);
+ if (old_flags & EGPS_S_V_REL)
+ new_flags |= SEC_RELOC;
+ if (old_flags & GPS_S_M_OVR)
+ new_flags |= SEC_IS_COMMON;
+ if (!bfd_set_section_flags (abfd, section, new_flags))
+ {
+ (*_bfd_error_handler)
+ (_("bfd_set_section_flags (%s, %x) failed"),
+ name, new_flags);
+ return -1;
+ }
+ section->alignment_power = vms_rec[1];
+ align_addr = (1 << section->alignment_power);
+ if ((base_addr % align_addr) != 0)
+ base_addr += (align_addr - (base_addr % align_addr));
+ section->vma = (bfd_vma)base_addr;
+ base_addr += section->size;
+
+ /* Global section is common symbol. */
+
+ if (old_flags & GPS_S_M_GBL)
+ {
+ entry = _bfd_vms_enter_symbol (abfd, name);
+ if (entry == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return -1;
+ }
+ symbol = entry->symbol;
+
+ symbol->value = 0;
+ symbol->section = section;
+ symbol->flags = (BSF_GLOBAL | BSF_SECTION_SYM | BSF_OLD_COMMON);
+ }
+
+ /* Copy saved contents if old_section set. */
+ if (old_section != 0)
+ {
+ section->contents = old_section->contents;
+ if (section->size < old_section->size)
+ {
+ (*_bfd_error_handler)
+ (_("Size mismatch section %s=%lx, %s=%lx"),
+ old_section->name,
+ (unsigned long) old_section->size,
+ section->name,
+ (unsigned long) section->size);
+ return -1;
+ }
+ else if (section->size > old_section->size)
+ {
+ section->contents = bfd_realloc (old_section->contents,
+ section->size);
+ if (section->contents == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return -1;
+ }
+ }
+ }
+ else
+ {
+ section->contents = bfd_zmalloc (section->size);
+ if (section->contents == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return -1;
+ }
+ }