PR ld/16017
authorNick Clifton <nickc@redhat.com>
Thu, 14 Nov 2013 15:39:51 +0000 (15:39 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 14 Nov 2013 15:39:51 +0000 (15:39 +0000)
* elf32-arm.c (elf32_arm_populate_plt_entry): Return a boolean
value, TRUE for success, FALSE for failure.
Fail if attempting to create a PLT entry for a thumb only target.
(elf32_arm_final_link_relocate): Check result of calling
elf32_arm_populate_plt_entry.
(elf32_arm_finish_dynamic_symbol): Likewise.

bfd/ChangeLog
bfd/elf32-arm.c

index a75204acbc460c79d6d1eb8a70bff6b83b517f25..c0c9fa80293ecf9c81419f5fce29c2dd34b17086 100644 (file)
@@ -1,3 +1,13 @@
+2013-11-14  Nick Clifton  <nickc@redhat.com>
+
+       PR ld/16017
+       * elf32-arm.c (elf32_arm_populate_plt_entry): Return a boolean
+       value, TRUE for success, FALSE for failure.
+       Fail if attempting to create a PLT entry for a thumb only target.
+       (elf32_arm_final_link_relocate): Check result of calling
+       elf32_arm_populate_plt_entry.
+       (elf32_arm_finish_dynamic_symbol): Likewise.
+
 2013-11-14  Guy Martin <gmsoft@tuxicoman.be>
 
        PR ld/16082
index e9c0d20aaf219f907663e6fa7c0299eeb112bf5a..70d6ac09357cebcd6b6f25c993344c906d08dc58 100644 (file)
@@ -7493,9 +7493,11 @@ arm_movt_immediate (bfd_vma value)
 
    ROOT_PLT points to the offset of the PLT entry from the start of its
    section (.iplt or .plt).  ARM_PLT points to the symbol's ARM-specific
-   bookkeeping information.  */
+   bookkeeping information.
 
-static void
+   Returns FALSE if there was a problem.  */
+
+static bfd_boolean
 elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
                              union gotplt_union *root_plt,
                              struct arm_plt_info *arm_plt,
@@ -7685,6 +7687,16 @@ elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
                        | (tail_displacement & 0x00ffffff),
                        ptr + 12);
        }
+      else if (using_thumb_only (htab))
+       {
+         /* PR ld/16017: Do not generate ARM instructions for
+            the PLT if compiling for a thumb-only target.
+
+            FIXME: We ought to be able to generate thumb PLT instructions...  */
+         _bfd_error_handler (_("%B: Warning: thumb mode PLT generation not currently supported"),
+                             output_bfd);
+         return FALSE;
+       }
       else
        {
          /* Calculate the displacement between the PLT slot and the
@@ -7750,6 +7762,8 @@ elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
       loc = srel->contents + plt_index * RELOC_SIZE (htab);
       SWAP_RELOC_OUT (htab) (output_bfd, &rel, loc);
     }
+
+  return TRUE;
 }
 
 /* Some relocations map to different relocations depending on the
@@ -8165,9 +8179,11 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
            plt_offset--;
          else
            {
-             elf32_arm_populate_plt_entry (output_bfd, info, root_plt, arm_plt,
-                                           -1, dynreloc_value);
-             root_plt->offset |= 1;
+             if (elf32_arm_populate_plt_entry (output_bfd, info, root_plt, arm_plt,
+                                               -1, dynreloc_value))
+               root_plt->offset |= 1;
+             else
+               return bfd_reloc_notsupported;
            }
 
          /* Static relocations always resolve to the .iplt entry.  */
@@ -14017,8 +14033,9 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd,
       if (!eh->is_iplt)
        {
          BFD_ASSERT (h->dynindx != -1);
-         elf32_arm_populate_plt_entry (output_bfd, info, &h->plt, &eh->plt,
-                                       h->dynindx, 0);
+         if (! elf32_arm_populate_plt_entry (output_bfd, info, &h->plt, &eh->plt,
+                                             h->dynindx, 0))
+           return FALSE;
        }
 
       if (!h->def_regular)