2010-06-25 Tristan Gingold <gingold@adacore.com>
* vms-alpha.c (_bfd_vms_write_egsd): Check absolute section with its flags. Create an absolute section if needed.
This commit is contained in:
parent
5868a63287
commit
4ba2ab9fc3
|
@ -1,3 +1,8 @@
|
||||||
|
2010-06-25 Tristan Gingold <gingold@adacore.com>
|
||||||
|
|
||||||
|
* vms-alpha.c (_bfd_vms_write_egsd): Check absolute section with
|
||||||
|
its flags. Create an absolute section if needed.
|
||||||
|
|
||||||
2010-06-25 Tristan Gingold <gingold@adacore.com>
|
2010-06-25 Tristan Gingold <gingold@adacore.com>
|
||||||
|
|
||||||
* vms-alpha.c (_bfd_vms_write_egsd): Set target_index field of
|
* vms-alpha.c (_bfd_vms_write_egsd): Set target_index field of
|
||||||
|
|
|
@ -3281,7 +3281,7 @@ _bfd_vms_write_egsd (bfd *abfd)
|
||||||
unsigned int symnum;
|
unsigned int symnum;
|
||||||
const char *sname;
|
const char *sname;
|
||||||
flagword new_flags, old_flags;
|
flagword new_flags, old_flags;
|
||||||
int abs_section_index = 0;
|
int abs_section_index = -1;
|
||||||
unsigned int target_index = 0;
|
unsigned int target_index = 0;
|
||||||
struct vms_rec_wr *recwr = &PRIV (recwr);
|
struct vms_rec_wr *recwr = &PRIV (recwr);
|
||||||
|
|
||||||
|
@ -3344,10 +3344,7 @@ _bfd_vms_write_egsd (bfd *abfd)
|
||||||
else if ((*sname == 'l') && (strcmp (sname, "literal") == 0))
|
else if ((*sname == 'l') && (strcmp (sname, "literal") == 0))
|
||||||
sname = EVAX_LITERAL_NAME;
|
sname = EVAX_LITERAL_NAME;
|
||||||
else if ((*sname == 'l') && (strcmp (sname, "literals") == 0))
|
else if ((*sname == 'l') && (strcmp (sname, "literals") == 0))
|
||||||
{
|
sname = EVAX_LITERALS_NAME;
|
||||||
sname = EVAX_LITERALS_NAME;
|
|
||||||
abs_section_index = section->target_index;
|
|
||||||
}
|
|
||||||
else if ((*sname == 'c') && (strcmp (sname, "comm") == 0))
|
else if ((*sname == 'c') && (strcmp (sname, "comm") == 0))
|
||||||
sname = EVAX_COMMON_NAME;
|
sname = EVAX_COMMON_NAME;
|
||||||
else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0))
|
else if ((*sname == 'l') && (strcmp (sname, "lcomm") == 0))
|
||||||
|
@ -3356,9 +3353,6 @@ _bfd_vms_write_egsd (bfd *abfd)
|
||||||
else
|
else
|
||||||
sname = _bfd_vms_length_hash_symbol (abfd, sname, EOBJ__C_SECSIZ);
|
sname = _bfd_vms_length_hash_symbol (abfd, sname, EOBJ__C_SECSIZ);
|
||||||
|
|
||||||
_bfd_vms_output_begin_subrec (recwr, EGSD__C_PSC);
|
|
||||||
_bfd_vms_output_short (recwr, section->alignment_power & 0xff);
|
|
||||||
|
|
||||||
if (bfd_is_com_section (section))
|
if (bfd_is_com_section (section))
|
||||||
new_flags = (EGPS__V_OVR | EGPS__V_REL | EGPS__V_GBL | EGPS__V_RD
|
new_flags = (EGPS__V_OVR | EGPS__V_REL | EGPS__V_GBL | EGPS__V_RD
|
||||||
| EGPS__V_WRT | EGPS__V_NOMOD | EGPS__V_COM);
|
| EGPS__V_WRT | EGPS__V_NOMOD | EGPS__V_COM);
|
||||||
|
@ -3377,10 +3371,17 @@ _bfd_vms_write_egsd (bfd *abfd)
|
||||||
vms_debug2 ((3, "new_flags %x, _raw_size %lu\n",
|
vms_debug2 ((3, "new_flags %x, _raw_size %lu\n",
|
||||||
new_flags, (unsigned long)section->size));
|
new_flags, (unsigned long)section->size));
|
||||||
|
|
||||||
|
_bfd_vms_output_begin_subrec (recwr, EGSD__C_PSC);
|
||||||
|
_bfd_vms_output_short (recwr, section->alignment_power & 0xff);
|
||||||
_bfd_vms_output_short (recwr, new_flags);
|
_bfd_vms_output_short (recwr, new_flags);
|
||||||
_bfd_vms_output_long (recwr, (unsigned long) section->size);
|
_bfd_vms_output_long (recwr, (unsigned long) section->size);
|
||||||
_bfd_vms_output_counted (recwr, sname);
|
_bfd_vms_output_counted (recwr, sname);
|
||||||
_bfd_vms_output_end_subrec (recwr);
|
_bfd_vms_output_end_subrec (recwr);
|
||||||
|
|
||||||
|
/* If the section is an obsolute one, remind its index as it will be
|
||||||
|
used later for absolute symbols. */
|
||||||
|
if ((new_flags & EGPS__V_REL) == 0 && abs_section_index < 0)
|
||||||
|
abs_section_index = section->target_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output symbols. */
|
/* Output symbols. */
|
||||||
|
@ -3395,7 +3396,8 @@ _bfd_vms_write_egsd (bfd *abfd)
|
||||||
symbol = abfd->outsymbols[symnum];
|
symbol = abfd->outsymbols[symnum];
|
||||||
old_flags = symbol->flags;
|
old_flags = symbol->flags;
|
||||||
|
|
||||||
/* Work-around a missing feature: consider __main as the main entry point. */
|
/* Work-around a missing feature: consider __main as the main entry
|
||||||
|
point. */
|
||||||
if (*(symbol->name) == '_')
|
if (*(symbol->name) == '_')
|
||||||
{
|
{
|
||||||
if (strcmp (symbol->name, "__main") == 0)
|
if (strcmp (symbol->name, "__main") == 0)
|
||||||
|
@ -3416,14 +3418,32 @@ _bfd_vms_write_egsd (bfd *abfd)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 13 bytes egsd, max 64 chars name -> should be 77 bytes. */
|
/* 13 bytes egsd, max 64 chars name -> should be 77 bytes. Add 16 more
|
||||||
if (_bfd_vms_output_check (recwr, 80) < 0)
|
bytes for a possible ABS section. */
|
||||||
|
if (_bfd_vms_output_check (recwr, 80 + 16) < 0)
|
||||||
{
|
{
|
||||||
_bfd_vms_output_end (abfd, recwr);
|
_bfd_vms_output_end (abfd, recwr);
|
||||||
_bfd_vms_output_begin (recwr, EOBJ__C_EGSD);
|
_bfd_vms_output_begin (recwr, EOBJ__C_EGSD);
|
||||||
_bfd_vms_output_long (recwr, 0);
|
_bfd_vms_output_long (recwr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((old_flags & BSF_GLOBAL) != 0
|
||||||
|
&& bfd_is_abs_section (symbol->section)
|
||||||
|
&& abs_section_index <= 0)
|
||||||
|
{
|
||||||
|
/* Create an absolute section if none was defined. It is highly
|
||||||
|
unlikely that the name $ABS$ clashes with a user defined
|
||||||
|
non-absolute section name. */
|
||||||
|
_bfd_vms_output_begin_subrec (recwr, EGSD__C_PSC);
|
||||||
|
_bfd_vms_output_short (recwr, 4);
|
||||||
|
_bfd_vms_output_short (recwr, EGPS__V_SHR);
|
||||||
|
_bfd_vms_output_long (recwr, 0);
|
||||||
|
_bfd_vms_output_counted (recwr, "$ABS$");
|
||||||
|
_bfd_vms_output_end_subrec (recwr);
|
||||||
|
|
||||||
|
abs_section_index = target_index++;
|
||||||
|
}
|
||||||
|
|
||||||
_bfd_vms_output_begin_subrec (recwr, EGSD__C_SYM);
|
_bfd_vms_output_begin_subrec (recwr, EGSD__C_SYM);
|
||||||
|
|
||||||
/* Data type, alignment. */
|
/* Data type, alignment. */
|
||||||
|
|
Loading…
Reference in New Issue