+ /* Write the change protection table. */
+ bfd_putl32 (off, eiaf->chgprtoff);
+ bfd_putl32 (chgprt_num, content + off);
+ off += 4;
+
+ for (sec = info->output_bfd->sections; sec != NULL; sec = sec->next)
+ {
+ struct vms_eicp *eicp;
+ unsigned int prot;
+
+ if ((sec->flags & SEC_LINKER_CREATED) != 0 &&
+ strcmp (sec->name, "$FIXUP$") == 0)
+ prot = PRT__C_UREW;
+ else if ((sec->flags & SEC_RELOC) != 0
+ && (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
+ prot = PRT__C_UR;
+ else
+ continue;
+
+ eicp = (struct vms_eicp *)(content + off);
+ bfd_putl64 (sec->vma - t->base_addr, eicp->baseva);
+ bfd_putl32 ((sec->size + VMS_BLOCK_SIZE - 1) & ~(VMS_BLOCK_SIZE - 1),
+ eicp->size);
+ bfd_putl32 (prot, eicp->newprt);
+ off += sizeof (struct vms_eicp);
+ }
+
+ return TRUE;
+}
+
+/* Called by bfd_hash_traverse to fill the symbol table.
+ Return FALSE in case of failure. */
+
+static bfd_boolean
+alpha_vms_link_output_symbol (struct bfd_hash_entry *bh, void *infov)
+{
+ struct bfd_link_hash_entry *hc = (struct bfd_link_hash_entry *) bh;
+ struct bfd_link_info *info = (struct bfd_link_info *)infov;
+ struct alpha_vms_link_hash_entry *h;
+ struct vms_symbol_entry *sym;
+
+ if (hc->type == bfd_link_hash_warning)
+ {
+ hc = hc->u.i.link;
+ if (hc->type == bfd_link_hash_new)
+ return TRUE;
+ }
+ h = (struct alpha_vms_link_hash_entry *) hc;
+
+ switch (h->root.type)
+ {
+ case bfd_link_hash_undefined:
+ return TRUE;
+ case bfd_link_hash_new:
+ case bfd_link_hash_warning:
+ abort ();
+ case bfd_link_hash_undefweak:
+ return TRUE;
+ case bfd_link_hash_defined:
+ case bfd_link_hash_defweak:
+ {
+ asection *sec = h->root.u.def.section;
+
+ /* FIXME: this is certainly a symbol from a dynamic library. */
+ if (bfd_is_abs_section (sec))
+ return TRUE;
+
+ if (sec->owner->flags & DYNAMIC)
+ return TRUE;
+ }
+ break;
+ case bfd_link_hash_common:
+ break;
+ case bfd_link_hash_indirect:
+ return TRUE;
+ }
+
+ /* Do not write not kept symbols. */
+ if (info->strip == strip_some
+ && bfd_hash_lookup (info->keep_hash, h->root.root.string,
+ FALSE, FALSE) != NULL)
+ return TRUE;
+
+ if (h->sym == NULL)
+ {
+ /* This symbol doesn't come from a VMS object. So we suppose it is
+ a data. */
+ int len = strlen (h->root.root.string);
+
+ sym = (struct vms_symbol_entry *)bfd_zalloc (info->output_bfd,
+ sizeof (*sym) + len);
+ if (sym == NULL)
+ abort ();
+ sym->namelen = len;
+ memcpy (sym->name, h->root.root.string, len);
+ sym->name[len] = 0;
+ sym->owner = info->output_bfd;
+
+ sym->typ = EGSD__C_SYMG;
+ sym->data_type = 0;
+ sym->flags = EGSY__V_DEF | EGSY__V_REL;
+ sym->symbol_vector = h->root.u.def.value;
+ sym->section = h->root.u.def.section;
+ sym->value = h->root.u.def.value;