aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-06-25 15:21:48 +0000
committerTristan Gingold <gingold@adacore.com>2010-06-25 15:21:48 +0000
commit1b3d1dbfad9b7e43048f995ebe1ec1908664c1d9 (patch)
tree08090537727394f8c52e70f749971c3284c54349
parent0f6a939d8663bfe0fcb4bf353c7ed5f6323b2de4 (diff)
downloadgdb-1b3d1dbfad9b7e43048f995ebe1ec1908664c1d9.zip
gdb-1b3d1dbfad9b7e43048f995ebe1ec1908664c1d9.tar.gz
gdb-1b3d1dbfad9b7e43048f995ebe1ec1908664c1d9.tar.bz2
2010-06-25 Tristan Gingold <gingold@adacore.com>
* vms-alpha.c (_bfd_vms_write_egsd): Set target_index field of sections. Mark .vmsdebug section as SEC_DEBUGGING. Do not create dummy psect anymore. Adjust. (_bfd_vms_write_eeom): Adjust (use target_index instead of index) (_bfd_vms_write_etir): Ditto. (start_etir_or_etbt_record): Test for SEC_DEBUGGING instead of section name. Adjust.
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/vms-alpha.c89
2 files changed, 53 insertions, 46 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d0b37bc..3971419 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,15 @@
2010-06-25 Tristan Gingold <gingold@adacore.com>
+ * vms-alpha.c (_bfd_vms_write_egsd): Set target_index field of
+ sections. Mark .vmsdebug section as SEC_DEBUGGING. Do not create
+ dummy psect anymore. Adjust.
+ (_bfd_vms_write_eeom): Adjust (use target_index instead of index)
+ (_bfd_vms_write_etir): Ditto.
+ (start_etir_or_etbt_record): Test for SEC_DEBUGGING instead of
+ section name. Adjust.
+
+2010-06-25 Tristan Gingold <gingold@adacore.com>
+
* vms-alpha.c (alpha_vms_write_exec): Set linktime field.
2010-06-25 Alan Modra <amodra@gmail.com>
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index ab1e3d5..6a6300c 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -2666,7 +2666,7 @@ _bfd_vms_write_eeom (bfd *abfd)
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);
@@ -3279,18 +3279,13 @@ _bfd_vms_write_egsd (bfd *abfd)
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);
@@ -3298,15 +3293,28 @@ _bfd_vms_write_egsd (bfd *abfd)
_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)
@@ -3316,20 +3324,6 @@ _bfd_vms_write_egsd (bfd *abfd)
_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;
@@ -3352,7 +3346,7 @@ _bfd_vms_write_egsd (bfd *abfd)
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;
@@ -3387,10 +3381,6 @@ _bfd_vms_write_egsd (bfd *abfd)
_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. */
@@ -3470,14 +3460,15 @@ done:
{
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);
@@ -3587,8 +3578,7 @@ start_etir_or_etbt_record (bfd *abfd, asection *section, bfd_vma offset)
{
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);
@@ -3612,7 +3602,7 @@ start_etir_or_etbt_record (bfd *abfd, asection *section, bfd_vma offset)
{
/* 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);
@@ -3717,7 +3707,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
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))
@@ -3852,7 +3842,8 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
{
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
@@ -3905,7 +3896,8 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
{
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);
@@ -3948,11 +3940,13 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
_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
@@ -3973,11 +3967,12 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
_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
@@ -3993,11 +3988,13 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
_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