struct hdr_struct hdr_data; /* data from HDR/EMH record */
struct eom_struct eom_data; /* data from EOM/EEOM record */
+ /* Transfer addresses (entry points). */
+ bfd_vma transfer_address[4];
+
/* Array of GSD sections to get the correspond BFD one. */
unsigned int section_max; /* Size of the sections array. */
unsigned int section_count; /* Number of GSD sections. */
struct module *modules; /* list of all compilation units */
- struct dst_info *dst_info;
asection *dst_section;
unsigned int dst_ptr_offsets_count; /* # of offsets in following array */
/* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible. */
-static struct sec_flags_struct evax_section_flags[] =
+static const struct sec_flags_struct evax_section_flags[] =
{
{ EVAX_ABS_NAME,
(EGPS__V_SHR),
(SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) }
};
-/* Retrieve bfd section flags by name and size. */
+/* Retrieve BFD section flags by name and size. */
static flagword
-vms_secflag_by_name (bfd *abfd ATTRIBUTE_UNUSED,
- struct sec_flags_struct *section_flags,
- char *name,
+vms_secflag_by_name (const struct sec_flags_struct *section_flags,
+ const char *name,
int hassize)
{
int i = 0;
return section_flags[i].flags_always;
}
-/* Retrieve vms section flags by name and size. */
+/* Retrieve VMS section flags by name and size. */
static flagword
-vms_esecflag_by_name (struct sec_flags_struct *section_flags,
- char *name,
- int hassize)
+vms_esecflag_by_name (const struct sec_flags_struct *section_flags,
+ const char *name,
+ int hassize)
{
int i = 0;
vms_section_data (section)->flags = old_flags;
vms_section_data (section)->no_flags = 0;
section->size = bfd_getl32 (egps->alloc);
- new_flags = vms_secflag_by_name (abfd, evax_section_flags, name,
+ new_flags = vms_secflag_by_name (evax_section_flags, name,
section->size > 0);
if (!(old_flags & EGPS__V_NOMOD))
{
if (!bfd_set_section_flags (abfd, section, new_flags))
return FALSE;
section->alignment_power = egps->align;
- align_addr = (1 << section->alignment_power);
- if ((base_addr % align_addr) != 0)
- base_addr += (align_addr - (base_addr % align_addr));
- section->vma = (bfd_vma)base_addr;
- base_addr += section->size;
- section->filepos = (unsigned int)-1;
+ if ((old_flags & EGPS__V_REL) != 0)
+ {
+ /* Give a non-overlapping vma to non absolute sections. */
+ align_addr = (1 << section->alignment_power);
+ if ((base_addr % align_addr) != 0)
+ base_addr += (align_addr - (base_addr % align_addr));
+ section->vma = (bfd_vma)base_addr;
+ base_addr += section->size;
+ }
+ else
+ section->vma = 0;
+ section->filepos = 0;
/* Append it to the section array. */
if (PRIV (section_count) >= PRIV (section_max))
bfd_putl32 (sizeof (struct vms_eiha), eiha->size);
bfd_putl32 (0, eiha->spare);
- bfd_putl32 (0x00000340, eiha->tfradr1); /* SYS$IMGACT */
- bfd_putl32 (0xffffffff, eiha->tfradr1_h);
- bfd_putl64 (bfd_get_start_address (abfd), eiha->tfradr2);
- bfd_putl64 (0, eiha->tfradr3);
- bfd_putl64 (0, eiha->tfradr4);
+ bfd_putl64 (PRIV (transfer_address[0]), eiha->tfradr1);
+ bfd_putl64 (PRIV (transfer_address[1]), eiha->tfradr2);
+ bfd_putl64 (PRIV (transfer_address[2]), eiha->tfradr3);
+ bfd_putl64 (PRIV (transfer_address[3]), eiha->tfradr4);
bfd_putl64 (0, eiha->inishr);
/* Alloc EIHI. */
unsigned int symnum;
int last_index = -1;
char dummy_name[10];
- char *sname;
+ const char *sname;
flagword new_flags, old_flags;
int abs_section_index = 0;
struct vms_rec_wr *recwr = &PRIV (recwr);
/* Don't know if this is necessary for the linker but for now it keeps
vms_slurp_gsd happy. */
- sname = (char *)section->name;
+ sname = section->name;
if (*sname == '.')
{
/* Remove leading dot. */
char *hash;
symbol = abfd->outsymbols[symnum];
+ old_flags = symbol->flags;
+
+ /* Work-around a missing feature: consider __main as the main entry point. */
if (*(symbol->name) == '_')
{
if (strcmp (symbol->name, "__main") == 0)
bfd_set_start_address (abfd, (bfd_vma)symbol->value);
}
- old_flags = symbol->flags;
+ /* Only put in the GSD the global and the undefined symbols. */
if (old_flags & BSF_FILE)
continue;
- if ((old_flags & BSF_GLOBAL) == 0 /* Not xdef... */
- && !bfd_is_und_section (symbol->section) /* and not xref... */
- && !((old_flags & BSF_SECTION_SYM) != 0 /* and not LIB$INITIALIZE. */
- && strcmp (symbol->section->name, "LIB$INITIALIZE") == 0))
- continue;
+ if ((old_flags & BSF_GLOBAL) == 0 && !bfd_is_und_section (symbol->section))
+ {
+ /* If the LIB$INITIIALIZE section is present, add a reference to
+ LIB$INITIALIZE symbol. FIXME: this should be done explicitely
+ in the assembly file. */
+ if (!((old_flags & BSF_SECTION_SYM) != 0
+ && strcmp (symbol->section->name, "LIB$INITIALIZE") == 0))
+ continue;
+ }
/* 13 bytes egsd, max 64 chars name -> should be 77 bytes. */
if (_bfd_vms_output_check (recwr, 80) < 0)
sec_len += len;
}
break;
+ case ETIR__C_STO_GBL_LW:
+ fprintf (file, _("STO_GBL_LW (store global longword) %.*s\n"),
+ buf[0], buf + 1);
+ break;
case ETIR__C_STO_LP_PSB:
fprintf (file, _("STO_OFF (store LP with procedure signature)\n"));
break;
}
}
+ /* Set transfer addresses. */
+ {
+ int i;
+ struct bfd_link_hash_entry *h;
+
+ i = 0;
+ PRIV (transfer_address[i++]) = 0xffffffff00000340ULL; /* SYS$IMGACT */
+ h = bfd_link_hash_lookup (info->hash, "LIB$INITIALIZE", FALSE, FALSE, TRUE);
+ if (h != NULL && h->type == bfd_link_hash_defined)
+ PRIV (transfer_address[i++]) =
+ alpha_vms_get_sym_value (h->u.def.section, h->u.def.value);
+ PRIV (transfer_address[i++]) = bfd_get_start_address (abfd);
+ while (i < 4)
+ PRIV (transfer_address[i++]) = 0;
+ }
+
/* Allocate contents. */
base_addr = (bfd_vma)-1;
last_addr = 0;
{_bfd_dummy_target, alpha_vms_object_p, /* bfd_check_format. */
_bfd_vms_lib_alpha_archive_p, _bfd_dummy_target},
{bfd_false, alpha_vms_mkobject, /* bfd_set_format. */
- _bfd_vms_lib_mkarchive, bfd_false},
+ _bfd_vms_lib_alpha_mkarchive, bfd_false},
{bfd_false, alpha_vms_write_object_contents, /* bfd_write_contents. */
_bfd_vms_lib_write_archive_contents, bfd_false},