+if test "$OUTPUT_FORMAT" = "elf64-ia64-vms"; then
+
+fragment <<EOF
+#include "elf-bfd.h"
+#include "ldelfgen.h"
+EOF
+
+source_em ${srcdir}/emultempl/elf-generic.em
+
+fragment <<EOF
+
+/* This is called after the sections have been attached to output
+ sections, but before any sizes or addresses have been set. */
+
+static void
+gld${EMULATION_NAME}_before_allocation (void)
+{
+ const struct elf_backend_data *bed;
+
+ if (!is_elf_hash_table (link_info.hash))
+ return;
+
+ bed = get_elf_backend_data (link_info.output_bfd);
+
+ /* The backend must work out the sizes of all the other dynamic
+ sections. */
+ if (elf_hash_table (&link_info)->dynamic_sections_created
+ && bed->elf_backend_size_dynamic_sections
+ && ! (*bed->elf_backend_size_dynamic_sections) (link_info.output_bfd,
+ &link_info))
+ einfo (_("%F%P: failed to set dynamic section sizes: %E\n"));
+
+ before_allocation_default ();
+}
+
+static void
+gld${EMULATION_NAME}_after_allocation (void)
+{
+ int need_layout = bfd_elf_discard_info (link_info.output_bfd, &link_info);
+
+ if (need_layout < 0)
+ einfo (_("%X%P: .eh_frame/.stab edit: %E\n"));
+ else
+ ldelf_map_segments (need_layout);
+}
+
+static void
+gld${EMULATION_NAME}_after_parse (void)
+{
+ link_info.relax_pass = 2;
+ after_parse_default ();
+}
+EOF
+
+LDEMUL_BEFORE_ALLOCATION=gld"$EMULATION_NAME"_before_allocation
+LDEMUL_AFTER_ALLOCATION=gld"$EMULATION_NAME"_after_allocation
+
+LDEMUL_AFTER_PARSE=gld${EMULATION_NAME}_after_parse
+source_em ${srcdir}/emultempl/needrelax.em
+fi
+