From 927be08ec81c122ef4872ec6d588965cbe05d7f9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 3 Feb 2010 12:03:35 +0000 Subject: bfd/ * elf64-ppc.c (struct plt_entry): Move earlier in file. (struct got_entry): Likewise. Add is_indirect and got.ent fields. (struct ppc64_elf_obj_tdata): Change tlsld_got to be a struct got_entry. Update all uses. (struct ppc_link_hash_table): Add got_reli_size and second_toc_pass. Remove no_multi_toc. (update_local_sym_info, ppc64_elf_check_relocs): Clear is_indirect when allocating a new struct got_entry. (allocate_got): New function, extracted from.. (allocate_dynrelocs): ..here. Abort on got entry in non-ppc64 bfd. (ppc64_elf_size_dynamic_sections): Track got relocs allocated in .reliplt by got_reli_size. Set owner on ppc64_tlsld_got entries. (ppc64_elf_setup_section_lists): Remove output_bfd param and no_multi_toc, add add_stub_section and layout_sections_again. Stash new params in htab. Extract some code to.. (ppc64_elf_start_multitoc_partition): ..here. New function. (ppc64_elf_next_toc_section): Check for linker script errors. Handle second pass toc scan. (merge_got_entries, merge_global_got, reallocate_got): New functions. (ppc64_elf_reinit_toc): Rename to.. (ppc64_elf_finish_multitoc_partition): ..this. (ppc64_elf_layout_multitoc): New function. (ppc64_elf_size_stubs): Delete output_bfd, add_stub_section and layout_sections_again params. (ppc64_elf_relocate_section): Handle indirect got entries. * elf64-ppc.h: Update prototypes. Declare new functions. ld/ * emultempl/ppc64elf.em (build_toc_list): Report errors from ppc64_elf_next_toc_section. (after_allocation): Update for changed function names and params. Run second pass of multitoc partitioning. --- ld/emultempl/ppc64elf.em | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'ld/emultempl') diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 88971d7..a11f300 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -1,5 +1,5 @@ # This shell script emits a C file. -*- C -*- -# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. # # This file is part of the GNU Binutils. @@ -279,7 +279,10 @@ build_toc_list (lang_statement_union_type *statement) if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag && (i->flags & SEC_EXCLUDE) == 0 && i->output_section == toc_section) - ppc64_elf_next_toc_section (&link_info, i); + { + if (!ppc64_elf_next_toc_section (&link_info, i)) + einfo ("%X%P: linker script separates .got and .toc\n"); + } } } @@ -319,27 +322,34 @@ gld${EMULATION_NAME}_after_allocation (void) stubs. */ if (stub_file != NULL && !link_info.relocatable) { - int ret = ppc64_elf_setup_section_lists (link_info.output_bfd, - &link_info, - no_multi_toc); + int ret = ppc64_elf_setup_section_lists (&link_info, + &ppc_add_stub_section, + &ppc_layout_sections_again); if (ret < 0) einfo ("%X%P: can not size stub section: %E\n"); else if (ret > 0) { - toc_section = bfd_get_section_by_name (link_info.output_bfd, ".got"); - if (toc_section != NULL) + ppc64_elf_start_multitoc_partition (&link_info); + + if (!no_multi_toc) + { + toc_section = bfd_get_section_by_name (link_info.output_bfd, + ".got"); + if (toc_section != NULL) + lang_for_each_statement (build_toc_list); + } + + if (ppc64_elf_layout_multitoc (&link_info) + && !no_multi_toc + && toc_section != NULL) lang_for_each_statement (build_toc_list); - ppc64_elf_reinit_toc (link_info.output_bfd, &link_info); + ppc64_elf_finish_multitoc_partition (&link_info); lang_for_each_statement (build_section_lists); /* Call into the BFD backend to do the real work. */ - if (!ppc64_elf_size_stubs (link_info.output_bfd, - &link_info, - group_size, - &ppc_add_stub_section, - &ppc_layout_sections_again)) + if (!ppc64_elf_size_stubs (&link_info, group_size)) einfo ("%X%P: can not size stub section: %E\n"); } } -- cgit v1.1