Remove has_bnd_reloc from elf_x86_64_link_hash_entry
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 27 Apr 2017 16:32:35 +0000 (09:32 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 27 Apr 2017 16:36:03 +0000 (09:36 -0700)
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

bfd/ChangeLog
bfd/elf64-x86-64.c

index e036de52acca4f2f87ba920bedae048896f0d6b2..9435b94fdb44dc39a10600f2ac5a991412460ca0 100644 (file)
@@ -1,3 +1,13 @@
+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
index 0e0a020393f8f6bd6e5bffbbea347f5ba3819100..c49162852540b46987639dfd7b2ce6e75ab77765 100644 (file)
@@ -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
        {
This page took 0.044846 seconds and 4 git commands to generate.