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 */
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. */
/* 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
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;
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;
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;
/* 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;
*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);
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;
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);
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;
}
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;
NULL,
- (PTR) 0
+ NULL
};