* elf.c (_bfd_elf_rela_local_sym): Accept asection **, and return
[deliverable/binutils-gdb.git] / bfd / elf64-ppc.c
index d6291f4e0452f70c8aad5d81d4236848bfdc85e9..8ae3f12ed888625b8c75e5065a03763e96978026 100644 (file)
@@ -6354,13 +6354,16 @@ static bfd_boolean
 ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
 {
   struct ppc_stub_hash_entry *stub_entry;
+  struct bfd_link_info *info;
   struct ppc_link_hash_table *htab;
   bfd_vma off;
   int size;
 
   /* Massage our args to the form they really have.  */
   stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
-  htab = in_arg;
+  info = in_arg;
+
+  htab = ppc_hash_table (info);
 
   if (stub_entry->stub_type == ppc_stub_plt_call)
     {
@@ -6427,6 +6430,9 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
              br_entry->iter = htab->stub_iteration;
              br_entry->offset = htab->brlt->_raw_size;
              htab->brlt->_raw_size += 8;
+
+             if (info->shared)
+               htab->relbrlt->_raw_size += sizeof (Elf64_External_Rela);
            }
 
          stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch;
@@ -7007,8 +7013,13 @@ ppc64_elf_size_stubs (bfd *output_bfd,
          }
       htab->brlt->_raw_size = 0;
       htab->brlt->_cooked_size = 0;
+      if (info->shared)
+       {
+         htab->relbrlt->_raw_size = 0;
+         htab->relbrlt->_cooked_size = 0;
+       }
 
-      bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, htab);
+      bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, info);
 
       /* Ask the linker to do its stuff.  */
       (*htab->layout_sections_again) ();
@@ -7211,6 +7222,13 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
       if (htab->brlt->contents == NULL)
        return FALSE;
     }
+  if (info->shared && htab->relbrlt->_raw_size != 0)
+    {
+      htab->relbrlt->contents = bfd_zalloc (htab->relbrlt->owner,
+                                           htab->relbrlt->_raw_size);
+      if (htab->relbrlt->contents == NULL)
+       return FALSE;
+    }
 
   /* Build the stubs as directed by the stub hash table.  */
   bfd_hash_traverse (&htab->stub_hash_table, ppc_build_one_stub, info);
@@ -7373,7 +7391,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
          sec = local_sections[r_symndx];
          sym_name = bfd_elf_local_sym_name (input_bfd, sym);
          sym_type = ELF64_ST_TYPE (sym->st_info);
-         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
          if (elf_section_data (sec) != NULL)
            {
              long *opd_sym_adjust;
@@ -8166,7 +8184,9 @@ ppc64_elf_relocate_section (bfd *output_bfd,
          relocation = TOCstart;
          if (r_symndx == 0)
            relocation += htab->stub_group[input_section->id].toc_off;
-         else if (sec != NULL && !unresolved_reloc)
+         else if (unresolved_reloc)
+           ;
+         else if (sec != NULL && sec->id <= htab->top_id)
            relocation += htab->stub_group[sec->id].toc_off;
          else
            unresolved_reloc = TRUE;
This page took 0.030496 seconds and 4 git commands to generate.