From a38a07e07c75f3d498fb9187a7924d159be6326c Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 6 Nov 2012 05:18:03 +0000 Subject: bfd/ * elf64-ppc.c (struct ppc_link_hash_table): Add dot_toc_dot. (ppc64_elf_size_stubs): Lookup ".TOC.". (ppc64_elf_relocate_section): Resolve special symbol ".TOC.". gas/ * config/tc-ppc.c (ppc_elf_adjust_symtab): New function, split out.. (ppc_frob_file_before_adjust): ..from here. (md_apply_fix): Set BSF_KEEP on .TOC. if not @tocbase. * config/tc-ppc.h (ppc_elf_adjust_symtab): Declare. (tc_adjust_symtab): Define. --- bfd/ChangeLog | 8 +++++++- bfd/elf64-ppc.c | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cebc007..ebec0d7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2012-11-06 Alan Modra + * elf64-ppc.c (struct ppc_link_hash_table): Add dot_toc_dot. + (ppc64_elf_size_stubs): Lookup ".TOC.". + (ppc64_elf_relocate_section): Resolve special symbol ".TOC.". + +2012-11-06 Alan Modra + * elf64-ppc.c (maybe_strip_output): Heed SEC_KEEP. 2012-11-05 Andreas Krebbel @@ -1589,7 +1595,7 @@ * reloc.c: Add new ENUM for BFD_RELOC_AVR_8_LO, BFD_RELOC_AVR_8_HI, BFD_RELOC_AVR_8_HHI. * bfd-in2.h: Regenerate. - * libbfd.h: Regenrate. + * libbfd.h: Regenerate. * elf32-avr.c (elf_avr_howto_table): Add entries for R_AVR_8_LO8, R_AVR_8_HI8, R_AVR_8_HHI8. (avr_reloc_map): Add RELOC mappings for R_AVR_8_LO8, R_AVR_8_HI8, diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 6bdc701..94f3c42 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -3757,6 +3757,9 @@ struct ppc_link_hash_table struct ppc_link_hash_entry *tls_get_addr; struct ppc_link_hash_entry *tls_get_addr_fd; + /* The special .TOC. symbol. */ + struct ppc_link_hash_entry *dot_toc_dot; + /* The size of reliplt used by got entry relocs. */ bfd_size_type got_reli_size; @@ -11364,6 +11367,9 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size, } } htab->plt_thread_safe = plt_thread_safe; + htab->dot_toc_dot = ((struct ppc_link_hash_entry *) + elf_link_hash_lookup (&htab->elf, ".TOC.", + FALSE, FALSE, TRUE)); stubs_always_before_branch = group_size < 0; if (group_size < 0) stub_group_size = -group_size; @@ -12362,6 +12368,13 @@ ppc64_elf_relocate_section (bfd *output_bfd, } } } + if (h_elf == &htab->dot_toc_dot->elf) + { + relocation = (TOCstart + + htab->stub_group[input_section->id].toc_off); + sec = bfd_abs_section_ptr; + unresolved_reloc = FALSE; + } } h = (struct ppc_link_hash_entry *) h_elf; -- cgit v1.1