This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove has_bnd_reloc from elf_x86_64_link_hash_entry


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=da3d25afa26476bf24247b8696fd00ab31f39db9

commit da3d25afa26476bf24247b8696fd00ab31f39db9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Apr 27 09:32:35 2017 -0700

    Remove has_bnd_reloc from elf_x86_64_link_hash_entry
    
    has_bnd_reloc was added to elf_x86_64_link_hash_entry track BND
    relocations by
    
    commit 0ff2b86e7c14177ec7f9e1257f8e697814794017
    Author: H.J. Lu <hjl.tools@gmail.com>
    Date:   Wed Nov 20 09:01:04 2013 -0800
    
        Create the second PLT for BND relocations
    
    Since BND relocations have been deprecated by
    
    commit d258b828287a863376af60a1ef7ceafbccc83d93
    Author: Igor Zamyatin <igor.zamyatin@intel.com>
    Date:   Tue Nov 18 10:52:36 2014 +0300
    
        Add -z bndplt to generate BND prefix in PLT entries
    
    This patch removes has_bnd_reloc from elf_x86_64_link_hash_entry and
    checks bndplt instead of has_bnd_reloc.
    
    	* elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
    	has_bnd_reloc.
    	(elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
    	(elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
    	(elf_x86_64_check_relocs): Don't set has_bnd_reloc.
    	(elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
    	has_bnd_reloc.
    
    Remove has_bnd_reloc

Diff:
---
 bfd/ChangeLog      | 10 ++++++++++
 bfd/elf64-x86-64.c | 13 +++----------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e036de5..9435b94 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,15 @@
 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
 
+	* elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
+	has_bnd_reloc.
+	(elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
+	(elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
+	(elf_x86_64_check_relocs): Don't set has_bnd_reloc.
+	(elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
+	has_bnd_reloc.
+
+2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* elf-bfd.h (elf_backend_data): Change setup_gnu_properties
 	to return bfd *.
 	(_bfd_elf_link_setup_gnu_properties): Return bfd *.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 0e0a020..c491628 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -858,9 +858,6 @@ struct elf_x86_64_link_hash_entry
      real definition and check it when allowing copy reloc in PIE.  */
   unsigned int needs_copy : 1;
 
-  /* TRUE if symbol has at least one BND relocation.  */
-  unsigned int has_bnd_reloc : 1;
-
   /* TRUE if symbol has GOT or PLT relocations.  */
   unsigned int has_got_reloc : 1;
 
@@ -883,7 +880,7 @@ struct elf_x86_64_link_hash_entry
      GOT and PLT relocations against the same function.  */
   union gotplt_union plt_got;
 
-  /* Information about the second PLT entry. Filled when has_bnd_reloc is
+  /* Information about the second PLT entry. Filled when info>bndplt is
      set.  */
   union gotplt_union plt_bnd;
 
@@ -1022,7 +1019,6 @@ elf_x86_64_link_hash_newfunc (struct bfd_hash_entry *entry,
       eh->dyn_relocs = NULL;
       eh->tls_type = GOT_UNKNOWN;
       eh->needs_copy = 0;
-      eh->has_bnd_reloc = 0;
       eh->has_got_reloc = 0;
       eh->has_non_got_reloc = 0;
       eh->no_finish_dynamic_symbol = 0;
@@ -1241,7 +1237,6 @@ elf_x86_64_copy_indirect_symbol (struct bfd_link_info *info,
   edir = (struct elf_x86_64_link_hash_entry *) dir;
   eind = (struct elf_x86_64_link_hash_entry *) ind;
 
-  edir->has_bnd_reloc |= eind->has_bnd_reloc;
   edir->has_got_reloc |= eind->has_got_reloc;
   edir->has_non_got_reloc |= eind->has_non_got_reloc;
 
@@ -2352,8 +2347,6 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
 		  && (get_elf_x86_64_backend_data (abfd)
 		      == &elf_x86_64_arch_bed))
 		{
-		  elf_x86_64_hash_entry (h)->has_bnd_reloc = 1;
-
 		  /* Create the second PLT for Intel MPX support.  */
 		  if (htab->plt_bnd == NULL)
 		    {
@@ -5898,7 +5891,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
 	  /* Use the second PLT with BND relocations.  */
 	  const bfd_byte *plt_entry, *plt2_entry;
 
-	  if (eh->has_bnd_reloc)
+	  if (info->bndplt)
 	    {
 	      plt_entry = elf_x86_64_bnd_plt_entry;
 	      plt2_entry = elf_x86_64_bnd_plt2_entry;
@@ -6046,7 +6039,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
 	 are the identical.  */
       plt_got_insn_size = elf_x86_64_bnd_arch_bed.plt_got_insn_size;
       plt_got_offset = elf_x86_64_bnd_arch_bed.plt_got_offset;
-      if (eh->has_bnd_reloc)
+      if (info->bndplt)
 	got_plt_entry = elf_x86_64_bnd_plt2_entry;
       else
 	{


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]