+ params.stub_bfd = stub_file->the_bfd;
+ if (params.save_restore_funcs < 0)
+ params.save_restore_funcs = !bfd_link_relocatable (&link_info);
+ if (!ppc64_elf_init_stub_bfd (&link_info, ¶ms))
+ einfo (_("%F%P: can not init BFD: %E\n"));
+}
+
+/* Called after opening files but before mapping sections. */
+
+static void
+ppc_after_open (void)
+{
+ if (stub_file != NULL && link_info.relro && params.object_in_toc)
+ {
+ /* We have a .toc section that might be written to at run time.
+ Don't put .toc into the .got output section. */
+ lang_output_section_statement_type *got;
+
+ got = lang_output_section_find (".got");
+ if (got != NULL)
+ {
+ lang_statement_union_type *s;
+ for (s = got->children.head; s != NULL; s = s->header.next)
+ if (s->header.type == lang_wild_statement_enum
+ && s->wild_statement.filename == NULL)
+ {
+ struct wildcard_list **i = &s->wild_statement.section_list;
+ while (*i != NULL)
+ if (strcmp ((*i)->spec.name, ".toc") == 0)
+ *i = (*i)->next;
+ else
+ i = &(*i)->next;
+ }
+ /* Instead, .toc input sections will be mapped to the
+ read/write .toc output section. If user scripts don't
+ provide one then we'll lose toc sorting and multi-toc. */
+ toc_section_name = ".toc";
+ }
+ }
+ gld${EMULATION_NAME}_after_open ();