Change arm-tdep.c to use type-safe registry
[deliverable/binutils-gdb.git] / bfd / elfxx-aarch64.c
index cae94d03e8453de0cceee1619668fff71a609edf..33af6c22e16b7534ed2fcc8e499fafd498d6835e 100644 (file)
@@ -695,6 +695,7 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
   bfd *pbfd;
   bfd *ebfd = NULL;
   elf_property *prop;
+  unsigned align;
 
   uint32_t gnu_prop = *gprop;
 
@@ -719,6 +720,11 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
       prop = _bfd_elf_get_property (ebfd,
                                    GNU_PROPERTY_AARCH64_FEATURE_1_AND,
                                    4);
+      if (gnu_prop & GNU_PROPERTY_AARCH64_FEATURE_1_BTI
+         && !(prop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI))
+           _bfd_error_handler (_("%pB: warning: BTI turned on by -z force-bti "
+                                 "when all inputs do not have BTI in NOTE "
+                                 "section."), ebfd);
       prop->u.number |= gnu_prop;
       prop->pr_kind = property_number;
 
@@ -738,6 +744,13 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
            info->callbacks->einfo (
              _("%F%P: failed to create GNU property section\n"));
 
+          align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3;
+          if (!bfd_set_section_alignment (ebfd, sec, align))
+            {
+              info->callbacks->einfo (_("%F%pA: failed to align section\n"),
+                                      sec);
+            }
+
          elf_section_type (sec) = SHT_NOTE;
        }
     }
@@ -863,3 +876,38 @@ _bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *info
 
   return updated;
 }
+
+/* Fix up AArch64 GNU properties.  */
+void
+_bfd_aarch64_elf_link_fixup_gnu_properties
+  (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+   elf_property_list **listp)
+{
+  elf_property_list *p, *prev;
+
+  for (p = *listp, prev = *listp; p; p = p->next)
+    {
+      unsigned int type = p->property.pr_type;
+      if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND)
+       {
+         if (p->property.pr_kind == property_remove)
+           {
+             /* Remove empty property.  */
+             if (prev == p)
+               {
+                 *listp = p->next;
+                 prev = *listp;
+               }
+             else
+                 prev->next = p->next;
+             continue;
+           }
+         prev = p;
+       }
+      else if (type > GNU_PROPERTY_HIPROC)
+       {
+         /* The property list is sorted in order of type.  */
+         break;
+       }
+    }
+}
This page took 0.023897 seconds and 4 git commands to generate.