2011-05-06 Tristan Gingold <gingold@adacore.com>

* vms-alpha.c (evax_section_flags): Remove SEC_IN_MEMORY.
	(_bfd_vms_slurp_egsd): Rename old_flags to vms_flags.  Handle
	any code section.  Add comments.
	(alpha_vms_object_p): Use void * instead of PTR.
	(alpha_vms_create_eisd_for_section): Fix test for setting DZRO.
	(build_module_list): Guard against no DST section.  Add comments.
	(alpha_vms_link_output_symbol): Discard undefined symbols.
	(alpha_vms_get_section_contents): Simply memcpy if the section was
	already loaded.  Fix typo.
	(vms_new_section_hook): Use void * instead of PTR.
	(vms_alpha_vec): Ditto.
This commit is contained in:
Tristan Gingold 2011-05-06 10:41:11 +00:00
parent 7d24e6a65a
commit 8185f55c76
2 changed files with 59 additions and 17 deletions

View File

@ -1,3 +1,17 @@
2011-05-06 Tristan Gingold <gingold@adacore.com>
* vms-alpha.c (evax_section_flags): Remove SEC_IN_MEMORY.
(_bfd_vms_slurp_egsd): Rename old_flags to vms_flags. Handle
any code section. Add comments.
(alpha_vms_object_p): Use void * instead of PTR.
(alpha_vms_create_eisd_for_section): Fix test for setting DZRO.
(build_module_list): Guard against no DST section. Add comments.
(alpha_vms_link_output_symbol): Discard undefined symbols.
(alpha_vms_get_section_contents): Simply memcpy if the section was
already loaded. Fix typo.
(vms_new_section_hook): Use void * instead of PTR.
(vms_alpha_vec): Ditto.
2011-05-06 Richard Sandiford <richard.sandiford@linaro.org>
* elf32-arm.c (cortex_a8_erratum_scan): If the stub is a Thumb

View File

@ -304,6 +304,7 @@ struct vms_private_data_struct
struct module *modules; /* list of all compilation units */
/* The DST section. */
asection *dst_section;
unsigned int dst_ptr_offsets_count; /* # of offsets in following array */
@ -992,7 +993,7 @@ static const struct sec_flags_struct evax_section_flags[] =
EGPS__V_REL | EGPS__V_RD | EGPS__V_WRT,
SEC_DATA,
EGPS__V_REL | EGPS__V_RD | EGPS__V_WRT,
SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD }
SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD }
};
/* Retrieve BFD section flags by name and size. */
@ -1129,14 +1130,15 @@ _bfd_vms_slurp_egsd (bfd *abfd)
/* Program section definition. */
{
struct vms_egps *egps = (struct vms_egps *)vms_rec;
flagword new_flags, old_flags;
flagword new_flags, vms_flags;
asection *section;
old_flags = bfd_getl16 (egps->flags);
vms_flags = bfd_getl16 (egps->flags);
if ((old_flags & EGPS__V_REL) == 0)
if ((vms_flags & EGPS__V_REL) == 0)
{
/* Use the global absolute section for all absolute sections. */
/* Use the global absolute section for all
absolute sections. */
section = bfd_abs_section_ptr;
}
else
@ -1154,17 +1156,27 @@ _bfd_vms_slurp_egsd (bfd *abfd)
section->size = bfd_getl32 (egps->alloc);
section->alignment_power = egps->align;
vms_section_data (section)->flags = old_flags;
vms_section_data (section)->flags = vms_flags;
vms_section_data (section)->no_flags = 0;
new_flags = vms_secflag_by_name (evax_section_flags, name,
section->size > 0);
if (!(old_flags & EGPS__V_NOMOD) && section->size > 0)
if (section->size > 0)
new_flags |= SEC_LOAD;
if (!(vms_flags & EGPS__V_NOMOD) && section->size > 0)
{
/* Set RELOC and HAS_CONTENTS if the section is not
demand-zero and not empty. */
new_flags |= SEC_HAS_CONTENTS;
if (old_flags & EGPS__V_REL)
if (vms_flags & EGPS__V_REL)
new_flags |= SEC_RELOC;
}
if (vms_flags & EGPS__V_EXE)
{
/* Set CODE if section is executable. */
new_flags |= SEC_CODE;
new_flags &= ~SEC_DATA;
}
if (!bfd_set_section_flags (abfd, section, new_flags))
return FALSE;
@ -2425,7 +2437,7 @@ vms_initialize (bfd * abfd)
static const struct bfd_target *
alpha_vms_object_p (bfd *abfd)
{
PTR tdata_save = abfd->tdata.any;
void *tdata_save = abfd->tdata.any;
unsigned int test_len;
unsigned char *buf;
@ -2908,7 +2920,7 @@ alpha_vms_create_eisd_for_section (bfd *abfd, asection *sec)
if (sec->flags & SEC_RELOC)
eisd->u.eisd.flags |= EISD__M_WRT | EISD__M_CRF;
if (!(sec->flags & SEC_LOAD))
if (!(sec->flags & SEC_HAS_CONTENTS))
{
eisd->u.eisd.flags |= EISD__M_DZRO;
eisd->u.eisd.flags &= ~EISD__M_CRF;
@ -4617,6 +4629,11 @@ build_module_list (bfd *abfd)
/* We don't have a DMT section so this must be an object. Parse
the module right now in order to compute its start address and
end address. */
void *dst = PRIV (dst_section)->contents;
if (dst == NULL)
return NULL;
module = new_module (abfd);
parse_module (abfd, module, PRIV (dst_section)->contents, -1);
list = module;
@ -4710,9 +4727,11 @@ _bfd_vms_find_nearest_dst_line (bfd *abfd, asection *section,
*func = NULL;
*line = 0;
/* We can't do anything if there is no DST (debug symbol table). */
if (PRIV (dst_section) == NULL)
return FALSE;
/* Create the module list - if not already done. */
if (PRIV (modules) == NULL)
{
PRIV (modules) = build_module_list (abfd);
@ -8593,8 +8612,9 @@ alpha_vms_link_output_symbol (struct bfd_link_hash_entry *hc, void *infov)
switch (h->root.type)
{
case bfd_link_hash_new:
case bfd_link_hash_undefined:
return TRUE;
case bfd_link_hash_new:
abort ();
case bfd_link_hash_undefweak:
return TRUE;
@ -8972,9 +8992,17 @@ alpha_vms_get_section_contents (bfd *abfd, asection *section,
return FALSE;
}
/* Alloc in memory and read ETIRs. */
BFD_ASSERT (section->contents == NULL);
/* If the section is already in memory, just copy it. */
if (section->flags & SEC_IN_MEMORY)
{
BFD_ASSERT (section->contents != NULL);
memcpy (buf, section->contents + offset, count);
return TRUE;
}
if (section->size == 0)
return TRUE;
/* Alloc in memory and read ETIRs. */
for (sec = abfd->sections; sec; sec = sec->next)
{
BFD_ASSERT (sec->contents == NULL);
@ -8989,8 +9017,8 @@ alpha_vms_get_section_contents (bfd *abfd, asection *section,
if (!alpha_vms_read_sections_content (abfd, NULL))
return FALSE;
for (sec = abfd->sections; sec; sec = sec->next)
if (section->contents)
section->flags |= SEC_IN_MEMORY;
if (sec->contents)
sec->flags |= SEC_IN_MEMORY;
memcpy (buf, section->contents + offset, count);
return TRUE;
}
@ -9083,7 +9111,7 @@ vms_new_section_hook (bfd * abfd, asection *section)
vms_debug2 ((7, "%d: %s\n", section->index, section->name));
amt = sizeof (struct vms_section_data_struct);
section->used_by_bfd = (PTR) bfd_zalloc (abfd, amt);
section->used_by_bfd = bfd_zalloc (abfd, amt);
if (section->used_by_bfd == NULL)
return FALSE;
@ -9360,5 +9388,5 @@ const bfd_target vms_alpha_vec =
NULL,
(PTR) 0
NULL
};