return FALSE;
}
_bfd_vms_output_short (recwr, 0);
- _bfd_vms_output_long (recwr, (unsigned long) (section->index));
+ _bfd_vms_output_long (recwr, (unsigned long) section->target_index);
_bfd_vms_output_long (recwr,
(unsigned long) bfd_get_start_address (abfd));
_bfd_vms_output_long (recwr, 0);
asection *section;
asymbol *symbol;
unsigned int symnum;
- int last_index = -1;
- char dummy_name[10];
const char *sname;
flagword new_flags, old_flags;
int abs_section_index = 0;
+ unsigned int target_index = 0;
struct vms_rec_wr *recwr = &PRIV (recwr);
- vms_debug2 ((2, "vms_write_gsd\n"));
-
- /* Output sections. */
- section = abfd->sections;
- vms_debug2 ((3, "%d sections found\n", abfd->section_count));
+ vms_debug2 ((2, "vms_write_egsd\n"));
/* Egsd is quadword aligned. */
_bfd_vms_output_alignment (recwr, 8);
_bfd_vms_output_begin (recwr, EOBJ__C_EGSD);
_bfd_vms_output_long (recwr, 0);
- while (section != 0)
+ /* Number sections. */
+ for (section = abfd->sections; section != NULL; section = section->next)
+ {
+ if (section->flags & SEC_DEBUGGING)
+ continue;
+ if (!strcmp (section->name, ".vmsdebug"))
+ {
+ section->flags |= SEC_DEBUGGING;
+ continue;
+ }
+ section->target_index = target_index++;
+ }
+
+ for (section = abfd->sections; section != NULL; section = section->next)
{
vms_debug2 ((3, "Section #%d %s, %d bytes\n",
- section->index, section->name, (int)section->size));
+ section->target_index, section->name, (int)section->size));
/* Don't write out the VMS debug info section since it is in the
ETBT and EDBG sections in etir. */
- if (!strcmp (section->name, ".vmsdebug"))
- goto done;
+ if (section->flags & SEC_DEBUGGING)
+ continue;
/* 13 bytes egsd, max 31 chars name -> should be 44 bytes. */
if (_bfd_vms_output_check (recwr, 64) < 0)
_bfd_vms_output_long (recwr, 0);
}
- /* Create dummy sections to keep consecutive indices. */
- while (section->index - last_index > 1)
- {
- vms_debug2 ((3, "index %d, last %d\n", section->index, last_index));
- _bfd_vms_output_begin_subrec (recwr, EGSD__C_PSC);
- _bfd_vms_output_short (recwr, 0);
- _bfd_vms_output_short (recwr, 0);
- _bfd_vms_output_long (recwr, 0);
- sprintf (dummy_name, ".DUMMY%02d", last_index);
- _bfd_vms_output_counted (recwr, dummy_name);
- _bfd_vms_output_end_subrec (recwr);
- last_index++;
- }
-
/* Don't know if this is necessary for the linker but for now it keeps
vms_slurp_gsd happy. */
sname = section->name;
else if ((*sname == 'l') && (strcmp (sname, "literals") == 0))
{
sname = EVAX_LITERALS_NAME;
- abs_section_index = section->index;
+ abs_section_index = section->target_index;
}
else if ((*sname == 'c') && (strcmp (sname, "comm") == 0))
sname = EVAX_COMMON_NAME;
_bfd_vms_output_long (recwr, (unsigned long) section->size);
_bfd_vms_output_counted (recwr, sname);
_bfd_vms_output_end_subrec (recwr);
-
- last_index = section->index;
-done:
- section = section->next;
}
/* Output symbols. */
{
asymbol *sym;
- sym = ((struct evax_private_udata_struct *)symbol->udata.p)->enbsym;
+ sym =
+ ((struct evax_private_udata_struct *)symbol->udata.p)->enbsym;
code_address = sym->value;
- ca_psindx = sym->section->index;
+ ca_psindx = sym->section->target_index;
}
if (bfd_is_abs_section (symbol->section))
psindx = abs_section_index;
else
- psindx = symbol->section->index;
+ psindx = symbol->section->target_index;
_bfd_vms_output_quad (recwr, symbol->value);
_bfd_vms_output_quad (recwr, code_address);
{
struct vms_rec_wr *recwr = &PRIV (recwr);
- if (section->name[0] == '.' && section->name[1] == 'v'
- && !strcmp (section->name, ".vmsdebug"))
+ if (section->flags & SEC_DEBUGGING)
{
_bfd_vms_output_begin (recwr, EOBJ__C_ETBT);
{
/* Push start offset. */
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ);
- _bfd_vms_output_long (recwr, (unsigned long) section->index);
+ _bfd_vms_output_long (recwr, (unsigned long) section->target_index);
_bfd_vms_output_quad (recwr, offset);
_bfd_vms_output_end_subrec (recwr);
for (section = abfd->sections; section; section = section->next)
{
vms_debug2 ((4, "writing %d. section '%s' (%d bytes)\n",
- section->index, section->name, (int) (section->size)));
+ section->target_index, section->name, (int) (section->size)));
if (!(section->flags & SEC_HAS_CONTENTS)
|| bfd_is_com_section (section))
{
etir_output_check (abfd, section, curr_addr, 32);
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ);
- _bfd_vms_output_long (recwr, (unsigned long) sec->index);
+ _bfd_vms_output_long (recwr,
+ (unsigned long) sec->target_index);
_bfd_vms_output_quad (recwr, rptr->addend + sym->value);
_bfd_vms_output_end_subrec (recwr);
/* ??? Table B-8 of the OpenVMS Linker Utilily Manual
{
etir_output_check (abfd, section, curr_addr, 32);
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ);
- _bfd_vms_output_long (recwr, (unsigned long) sec->index);
+ _bfd_vms_output_long (recwr,
+ (unsigned long) sec->target_index);
_bfd_vms_output_quad (recwr, rptr->addend + sym->value);
_bfd_vms_output_end_subrec (recwr);
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STO_OFF);
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STC_NOP_GBL);
_bfd_vms_output_long (recwr, (unsigned long) udata->lkindex);
_bfd_vms_output_long
- (recwr, (unsigned long) udata->enbsym->section->index);
+ (recwr,
+ (unsigned long) udata->enbsym->section->target_index);
_bfd_vms_output_quad (recwr, rptr->address);
_bfd_vms_output_long (recwr, (unsigned long) 0x47ff041f);
_bfd_vms_output_long
- (recwr, (unsigned long) udata->enbsym->section->index);
+ (recwr,
+ (unsigned long) udata->enbsym->section->target_index);
_bfd_vms_output_quad (recwr, rptr->addend);
_bfd_vms_output_counted
(recwr, _bfd_vms_length_hash_symbol
_bfd_vms_output_long
(recwr, (unsigned long) udata->lkindex + 1);
_bfd_vms_output_long
- (recwr, (unsigned long) udata->enbsym->section->index);
+ (recwr,
+ (unsigned long) udata->enbsym->section->target_index);
_bfd_vms_output_quad (recwr, rptr->address);
_bfd_vms_output_long (recwr, (unsigned long) 0x237B0000);
_bfd_vms_output_long
- (recwr, (unsigned long) udata->bsym->section->index);
+ (recwr, (unsigned long) udata->bsym->section->target_index);
_bfd_vms_output_quad (recwr, rptr->addend);
_bfd_vms_output_counted
(recwr, _bfd_vms_length_hash_symbol
_bfd_vms_output_begin_subrec (recwr, ETIR__C_STC_BOH_GBL);
_bfd_vms_output_long (recwr, (unsigned long) udata->lkindex);
_bfd_vms_output_long
- (recwr, (unsigned long) udata->enbsym->section->index);
+ (recwr,
+ (unsigned long) udata->enbsym->section->target_index);
_bfd_vms_output_quad (recwr, rptr->address);
_bfd_vms_output_long (recwr, (unsigned long) 0xD3400000);
_bfd_vms_output_long
- (recwr, (unsigned long) udata->enbsym->section->index);
+ (recwr,
+ (unsigned long) udata->enbsym->section->target_index);
_bfd_vms_output_quad (recwr, rptr->addend);
_bfd_vms_output_counted
(recwr, _bfd_vms_length_hash_symbol