[AArch64] Remove redundant calculation of plt stub destination for veneer
authorJiong Wang <jiong.wang@arm.com>
Mon, 22 Feb 2016 12:16:06 +0000 (12:16 +0000)
committerJiong Wang <jiong.wang@arm.com>
Mon, 22 Feb 2016 12:16:06 +0000 (12:16 +0000)
elfNN_aarch64_size_stubs, the caller of aarch64_type_stub has redirected
the final destination of long branch veneer to plt stub if the call
should go through it.

It's redundant to do the same check and redirect again from scratch
inside aarch64_type_stub.

bfd/
  * elfnn-aarch64. (aarch64_type_of_stub): Remove redundation calcuation
  for destination.  Remove useless function parameters.
  (elfNN_aarch64_size_stubs): Update parameters for aarch64_type_of_stub.

bfd/ChangeLog
bfd/elfnn-aarch64.c

index 17b24c10b07cca55220b40409c751af5f84f7d3c..7878822208910626df70de908622c44037f5b817 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-22  Jiong Wang  <jiong.wang@arm.com>
+
+       * elfnn-aarch64. (aarch64_type_of_stub): Remove redundation calcuation
+       for destination.  Remove useless function parameters.
+       (elfNN_aarch64_size_stubs): Update parameters for aarch64_type_of_stub.
+
 2016-02-19  Nick Clifton  <nickc@redhat.com>
 
        PR ld/19629
index 99acab4e7d0b60223e8a2984be1355c64f76e225..16a6eea92182a90a2a927aafb1c1077290031911 100644 (file)
@@ -2639,34 +2639,21 @@ aarch64_select_branch_stub (bfd_vma value, bfd_vma place)
 /* Determine the type of stub needed, if any, for a call.  */
 
 static enum elf_aarch64_stub_type
-aarch64_type_of_stub (struct bfd_link_info *info,
-                     asection *input_sec,
+aarch64_type_of_stub (asection *input_sec,
                      const Elf_Internal_Rela *rel,
                      asection *sym_sec,
                      unsigned char st_type,
-                     struct elf_aarch64_link_hash_entry *hash,
                      bfd_vma destination)
 {
   bfd_vma location;
   bfd_signed_vma branch_offset;
   unsigned int r_type;
-  struct elf_aarch64_link_hash_table *globals;
   enum elf_aarch64_stub_type stub_type = aarch64_stub_none;
-  bfd_boolean via_plt_p;
 
   if (st_type != STT_FUNC
       && (sym_sec == input_sec))
     return stub_type;
 
-  globals = elf_aarch64_hash_table (info);
-  via_plt_p = (globals->root.splt != NULL && hash != NULL
-              && hash->root.plt.offset != (bfd_vma) - 1);
-  /* Make sure call to plt stub can fit into the branch range.  */
-  if (via_plt_p)
-    destination = (globals->root.splt->output_section->vma
-                  + globals->root.splt->output_offset
-                  + hash->root.plt.offset);
-
   /* Determine where the call point is.  */
   location = (input_sec->output_offset
              + input_sec->output_section->vma + rel->r_offset);
@@ -4142,8 +4129,8 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
                    }
 
                  /* Determine what (if any) linker stub is needed.  */
-                 stub_type = aarch64_type_of_stub
-                   (info, section, irela, sym_sec, st_type, hash, destination);
+                 stub_type = aarch64_type_of_stub (section, irela, sym_sec,
+                                                   st_type, destination);
                  if (stub_type == aarch64_stub_none)
                    continue;