* elf32-ppc.c (ppc_elf_check_relocs): Set PLT_IFUNC in local got
authorAlan Modra <amodra@gmail.com>
Wed, 27 Mar 2013 13:25:48 +0000 (13:25 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 27 Mar 2013 13:25:48 +0000 (13:25 +0000)
masks for all local ifunc syms.
(allocate_dynrelocs): Don't use htab->relgot for ifunc.
(ppc_elf_size_dynamic_sections): Likewise.
(ppc_elf_relocate_section): Likewise.

bfd/ChangeLog
bfd/elf32-ppc.c

index 6d3e973fbab272ce118bd1e867c2a146a6aa2579..6253a24e7de474a4ec9142ed9897183bcb0c9c40 100644 (file)
@@ -1,3 +1,11 @@
+2013-03-27  Alan Modra  <amodra@gmail.com>
+
+       * elf32-ppc.c (ppc_elf_check_relocs): Set PLT_IFUNC in local got
+       masks for all local ifunc syms.
+       (allocate_dynrelocs): Don't use htab->relgot for ifunc.
+       (ppc_elf_size_dynamic_sections): Likewise.
+       (ppc_elf_relocate_section): Likewise.
+
 2013-03-27  Will Newton  <will.newton@linaro.org>
 
        * elf32-arm.c (elf32_arm_final_link_relocate): Avoid emitting a
index c05f2f01a9fb48e91e68a55ba067c6cfb103e2f5..05d6e351adcbce37dd78b8a759b523b4cfa1ffc5 100644 (file)
@@ -3921,13 +3921,11 @@ ppc_elf_check_relocs (bfd *abfd,
          if (isym == NULL)
            return FALSE;
 
-         if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC
-             && (!info->shared
-                 || is_branch_reloc (r_type)))
+         if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
            {
              struct plt_entry **ifunc;
-             bfd_vma addend;
 
+             /* Set PLT_IFUNC flag for this sym, no GOT entry yet.  */
              ifunc = update_local_sym_info (abfd, symtab_hdr, r_symndx,
                                             PLT_IFUNC);
              if (ifunc == NULL)
@@ -3936,15 +3934,19 @@ ppc_elf_check_relocs (bfd *abfd,
              /* STT_GNU_IFUNC symbols must have a PLT entry;
                 In a non-pie executable even when there are
                 no plt calls.  */
-             addend = 0;
-             if (r_type == R_PPC_PLTREL24)
+             if (!info->shared
+                 || is_branch_reloc (r_type))
                {
-                 ppc_elf_tdata (abfd)->makes_plt_call = 1;
-                 if (info->shared)
-                   addend = rel->r_addend;
+                 bfd_vma addend = 0;
+                 if (r_type == R_PPC_PLTREL24)
+                   {
+                     ppc_elf_tdata (abfd)->makes_plt_call = 1;
+                     if (info->shared)
+                       addend = rel->r_addend;
+                   }
+                 if (!update_plt_info (abfd, ifunc, got2, addend))
+                   return FALSE;
                }
-             if (!update_plt_info (abfd, ifunc, got2, addend))
-               return FALSE;
            }
        }
 
@@ -5901,6 +5903,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
                  || eh->elf.root.type != bfd_link_hash_undefweak))
            {
              asection *rsec = htab->relgot;
+
+             if (eh->elf.type == STT_GNU_IFUNC)
+               rsec = htab->reliplt;
              /* All the entries we allocated need relocs.
                 Except LD only needs one.  */
              if ((eh->tls_mask & TLS_LD) != 0
@@ -6181,8 +6186,12 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
              {
                *local_got = allocate_got (htab, need);
                if (info->shared)
-                 htab->relgot->size += (need
-                                        * (sizeof (Elf32_External_Rela) / 4));
+                 {
+                   asection *srel = htab->relgot;
+                   if ((*lgot_masks & PLT_IFUNC) != 0)
+                     srel = htab->reliplt;
+                   srel->size += need * (sizeof (Elf32_External_Rela) / 4);
+                 }
              }
          }
        else
@@ -7987,6 +7996,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
                        asection *rsec = htab->relgot;
                        bfd_byte * loc;
 
+                       if (ifunc != NULL)
+                         rsec = htab->reliplt;
                        outrel.r_offset = (htab->got->output_section->vma
                                           + htab->got->output_offset
                                           + off);
This page took 0.02963 seconds and 4 git commands to generate.