public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [AArch64] Remove redundant tls relaxation check in elfNN_aarch64_final_link_relocate
@ 2016-05-09 13:43 Jiong Wang
  2016-05-11 10:24 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Jiong Wang @ 2016-05-09 13:43 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1092 bytes --]

The current code flow for applying relocation is:

   elfNN_aarch64_relocate_section

           |
           v

      elfNN_aarch64_final_link_relocate


In elfNN_aarch64_relocate_section, before calling
elfNN_aarch64_final_link_relocate, we have called aarch64_tls_transition
to get relaxed TLS relocation types

   relaxed_bfd_r_type =
     aarch64_tls_transition (input_bfd, info, r_type, h, r_symndx);

What passed to elfNN_aarch64_final_link_relocate is expected to be the
relaxed TLS reloc types.

elfNN_aarch64_final_link_relocate should not do further tls type transition,
otherwise there will be inconsistent between elfNN_aarch64_relocate_section
and elfNN_aarch64_final_link_relocate.

This redundant check also unnecessarily slowed down AArch64 linking speed.  After
this patch, it will be 1.5% ~ 3.5% faster when linking several huge programs from my
tests.

No regression on AArch64 native ld check.

OK for master?

2016-05-09  Jiong Wang  <jiong.wang@arm.com>

bfd/
   * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Remove redundant
   aarch64_tls_transition check.


[-- Attachment #2: final.patch --]
[-- Type: text/x-patch, Size: 1522 bytes --]

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index eecbf87..81bb011 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -4895,7 +4895,9 @@ elfNN_aarch64_write_section (bfd *output_bfd  ATTRIBUTE_UNUSED,
   return FALSE;
 }
 
-/* Perform a relocation as part of a final link.  */
+/* Perform a relocation as part of a final link.  The input relocation type
+   should be TLS relaxed.  */
+
 static bfd_reloc_status_type
 elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
 				   bfd *input_bfd,
@@ -4916,7 +4918,6 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
   unsigned int r_type = howto->type;
   bfd_reloc_code_real_type bfd_r_type
     = elfNN_aarch64_bfd_reloc_from_howto (howto);
-  bfd_reloc_code_real_type new_bfd_r_type;
   unsigned long r_symndx;
   bfd_byte *hit_data = contents + rel->r_offset;
   bfd_vma place, off;
@@ -4933,17 +4934,6 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
 
   r_symndx = ELFNN_R_SYM (rel->r_info);
 
-  /* It is possible to have linker relaxations on some TLS access
-     models.  Update our information here.  */
-  new_bfd_r_type = aarch64_tls_transition (input_bfd, info, r_type, h, r_symndx);
-  if (new_bfd_r_type != bfd_r_type)
-    {
-      bfd_r_type = new_bfd_r_type;
-      howto = elfNN_aarch64_howto_from_bfd_reloc (bfd_r_type);
-      BFD_ASSERT (howto != NULL);
-      r_type = howto->type;
-    }
-
   place = input_section->output_section->vma
     + input_section->output_offset + rel->r_offset;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [AArch64] Remove redundant tls relaxation check in elfNN_aarch64_final_link_relocate
  2016-05-09 13:43 [AArch64] Remove redundant tls relaxation check in elfNN_aarch64_final_link_relocate Jiong Wang
@ 2016-05-11 10:24 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2016-05-11 10:24 UTC (permalink / raw)
  To: Jiong Wang, binutils

Hi Jiong,

> 2016-05-09  Jiong Wang  <jiong.wang@arm.com>
> bfd/
>   * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Remove redundant
>   aarch64_tls_transition check.

Approved - please apply.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-11 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 13:43 [AArch64] Remove redundant tls relaxation check in elfNN_aarch64_final_link_relocate Jiong Wang
2016-05-11 10:24 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).