AArch64: Add gdbserver MTE support
[deliverable/binutils-gdb.git] / bfd / elfxx-x86.c
index c47f48257eabe7cd225eb0acb3bc679a98a9f0b1..6ff9fd56ee732a36e35fd0207bee346392d9f01a 100644 (file)
@@ -686,13 +686,13 @@ elf_x86_link_hash_table_free (bfd *obfd)
 static bfd_boolean
 elf_i386_is_reloc_section (const char *secname)
 {
-  return CONST_STRNEQ (secname, ".rel");
+  return startswith (secname, ".rel");
 }
 
 static bfd_boolean
 elf_x86_64_is_reloc_section (const char *secname)
 {
-  return CONST_STRNEQ (secname, ".rela");
+  return startswith (secname, ".rela");
 }
 
 /* Create an x86 ELF linker hash table.  */
@@ -1711,8 +1711,7 @@ _bfd_x86_elf_link_fixup_ifunc_symbol (struct bfd_link_info *info,
       && h->def_regular
       && h->dynindx != -1
       && h->plt.offset != (bfd_vma) -1
-      && h->type == STT_GNU_IFUNC
-      && h->pointer_equality_needed)
+      && h->type == STT_GNU_IFUNC)
     {
       asection *plt_s;
       bfd_vma plt_offset;
@@ -1742,6 +1741,53 @@ _bfd_x86_elf_link_fixup_ifunc_symbol (struct bfd_link_info *info,
     }
 }
 
+/* Report relative relocation.  */
+
+void
+_bfd_x86_elf_link_report_relative_reloc
+  (struct bfd_link_info *info, asection *asect,
+   struct elf_link_hash_entry *h, Elf_Internal_Sym *sym,
+   const char *reloc_name, const void *reloc)
+{
+  const char *name;
+  bfd *abfd;
+  const Elf_Internal_Rela *rel = (const Elf_Internal_Rela *) reloc;
+  char r_offset[30], r_info[30];
+
+  /* Use the output BFD for linker created sections.  */
+  if ((asect->flags & SEC_LINKER_CREATED) != 0)
+    abfd = info->output_bfd;
+  else
+    abfd = asect->owner;
+
+  if (h != NULL && h->root.root.string != NULL)
+    name = h->root.root.string;
+  else
+    name = bfd_elf_sym_name (abfd, &elf_symtab_hdr (abfd), sym, NULL);
+
+  bfd_sprintf_vma (abfd, r_offset, rel->r_offset);
+  bfd_sprintf_vma (abfd, r_info, rel->r_info);
+
+  if (asect->use_rela_p)
+    {
+      char r_addend[30];
+
+      bfd_sprintf_vma (abfd, r_addend, rel->r_addend);
+
+      info->callbacks->einfo
+       (_("%pB: %s (offset: 0x%s, info: 0x%s, addend: 0x%s) against "
+          "'%s' " "for section '%pA' in %pB\n"),
+        info->output_bfd, reloc_name, r_offset, r_info, r_addend,
+        name, asect, abfd);
+    }
+  else
+    info->callbacks->einfo
+      (_("%pB: %s (offset: 0x%s, info: 0x%s) against '%s' for section "
+        "'%pA' in %pB\n"),
+       info->output_bfd, reloc_name, r_offset, r_info, name,
+       asect, abfd);
+}
+
 /* Return TRUE if symbol should be hashed in the `.gnu.hash' section.  */
 
 bfd_boolean
@@ -2449,8 +2495,15 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info,
                features = GNU_PROPERTY_X86_FEATURE_1_IBT;
              if (htab->params->shstk)
                features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
-             /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
-                GNU_PROPERTY_X86_FEATURE_1_SHSTK.  */
+             if (htab->params->lam_u48)
+               features |= (GNU_PROPERTY_X86_FEATURE_1_LAM_U48
+                            | GNU_PROPERTY_X86_FEATURE_1_LAM_U57);
+             else if (htab->params->lam_u57)
+               features |= GNU_PROPERTY_X86_FEATURE_1_LAM_U57;
+             /* Add GNU_PROPERTY_X86_FEATURE_1_IBT,
+                GNU_PROPERTY_X86_FEATURE_1_SHSTK,
+                GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
+                GNU_PROPERTY_X86_FEATURE_1_LAM_U57.  */
              aprop->u.number |= features;
            }
          updated = number != (unsigned int) aprop->u.number;
@@ -2470,6 +2523,11 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info,
                features = GNU_PROPERTY_X86_FEATURE_1_IBT;
              if (htab->params->shstk)
                features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+             if (htab->params->lam_u48)
+               features |= (GNU_PROPERTY_X86_FEATURE_1_LAM_U48
+                            | GNU_PROPERTY_X86_FEATURE_1_LAM_U57);
+             else if (htab->params->lam_u57)
+               features |= GNU_PROPERTY_X86_FEATURE_1_LAM_U57;
            }
          if (features)
            {
This page took 0.023899 seconds and 4 git commands to generate.