+ /* __rtinit */
+ if ((bfd_get_flavour (link_info.output_bfd) == bfd_target_xcoff_flavour)
+ && (link_info.init_function != NULL
+ || link_info.fini_function != NULL
+ || rtld))
+ {
+ initfini_file = lang_add_input_file ("initfini",
+ lang_input_file_is_file_enum,
+ NULL);
+
+ initfini_file->the_bfd = bfd_create ("initfini", link_info.output_bfd);
+ if (initfini_file->the_bfd == NULL
+ || ! bfd_set_arch_mach (initfini_file->the_bfd,
+ bfd_get_arch (link_info.output_bfd),
+ bfd_get_mach (link_info.output_bfd)))
+ {
+ einfo ("%X%P: can not create BFD %E\n");
+ return;
+ }
+
+ /* Call backend to fill in the rest */
+ if (! bfd_xcoff_link_generate_rtinit (initfini_file->the_bfd,
+ link_info.init_function,
+ link_info.fini_function,
+ rtld))
+ {
+ einfo ("%X%P: can not create BFD %E\n");
+ return;
+ }
+
+ /* __rtld defined in /lib/librtl.a */
+ if (rtld)
+ lang_add_input_file ("rtl", lang_input_file_is_l_enum, NULL);
+ }
+}
+
+static void
+gld${EMULATION_NAME}_set_output_arch (void)
+{
+ bfd_set_arch_mach (link_info.output_bfd,
+ bfd_xcoff_architecture (link_info.output_bfd),
+ bfd_xcoff_machine (link_info.output_bfd));
+
+ ldfile_output_architecture = bfd_get_arch (link_info.output_bfd);
+ ldfile_output_machine = bfd_get_mach (link_info.output_bfd);
+ ldfile_output_machine_name = bfd_printable_name (link_info.output_bfd);
+}
+
+static bfd_boolean
+gld${EMULATION_NAME}_open_dynamic_archive (const char *arch,
+ search_dirs_type *search,
+ lang_input_statement_type *entry)
+{
+ char *path;
+
+ if (!entry->flags.maybe_archive)
+ return FALSE;
+
+ if (entry->flags.full_name_provided)
+ path = concat (search->name, "/", entry->filename,
+ (const char *) NULL);
+ else
+ path = concat (search->name, "/lib", entry->filename, arch, ".a",
+ (const char *) NULL);
+
+ if (!ldfile_try_open_bfd (path, entry))
+ {
+ free (path);
+ return FALSE;
+ }
+ /* Don't include the searched directory in the import path. */
+ bfd_xcoff_set_archive_import_path (&link_info, entry->the_bfd,
+ path + strlen (search->name) + 1);
+ entry->filename = path;
+ return TRUE;
+}
+
+struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {