202493
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
202493
--- binutils.orig/bfd/elfnn-aarch64.c	2020-11-04 14:53:52.144476367 +0000
202493
+++ binutils-2.30/bfd/elfnn-aarch64.c	2020-11-04 14:56:42.275422499 +0000
202493
@@ -2191,6 +2191,9 @@ struct elf_aarch64_obj_tdata
202493
 
202493
   /* Zero to warn when linking objects with incompatible wchar_t sizes.  */
202493
   int no_wchar_size_warning;
202493
+
202493
+  /* All GNU_PROPERTY_AARCH64_FEATURE_1_AND properties.  */
202493
+  uint32_t gnu_and_prop;
202493
 };
202493
 
202493
 #define elf_aarch64_tdata(bfd)				\
202493
@@ -9311,6 +9314,32 @@ elfNN_aarch64_backend_symbol_processing
202493
     sym->flags |= BSF_KEEP;
202493
 }
202493
 
202493
+/* Implement elf_backend_setup_gnu_properties for AArch64.  It serves as a
202493
+   wrapper function for _bfd_aarch64_elf_link_setup_gnu_properties to account
202493
+   for the effect of GNU properties of the output_bfd.  */
202493
+static bfd *
202493
+elfNN_aarch64_link_setup_gnu_properties (struct bfd_link_info *info)
202493
+{
202493
+  uint32_t prop = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
202493
+  bfd *pbfd = _bfd_aarch64_elf_link_setup_gnu_properties (info, &prop);
202493
+  elf_aarch64_tdata (info->output_bfd)->gnu_and_prop = prop;
202493
+  return pbfd;
202493
+}
202493
+
202493
+/* Implement elf_backend_merge_gnu_properties for AArch64.  It serves as a
202493
+   wrapper function for _bfd_aarch64_elf_merge_gnu_properties to account
202493
+   for the effect of GNU properties of the output_bfd.  */
202493
+static bfd_boolean
202493
+elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
202493
+				       bfd *abfd,
202493
+				       elf_property *aprop,
202493
+				       elf_property *bprop)
202493
+{
202493
+  uint32_t prop
202493
+    = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
202493
+  return  _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
202493
+						 bprop, prop);
202493
+}
202493
 
202493
 /* We use this so we can override certain functions
202493
    (though currently we don't).  */
202493
@@ -9453,6 +9482,12 @@ const struct elf_size_info elfNN_aarch64
202493
 #define elf_backend_symbol_processing		\
202493
   elfNN_aarch64_backend_symbol_processing
202493
 
202493
+#define elf_backend_setup_gnu_properties	\
202493
+  elfNN_aarch64_link_setup_gnu_properties
202493
+
202493
+#define elf_backend_merge_gnu_properties	\
202493
+  elfNN_aarch64_merge_gnu_properties
202493
+
202493
 #define elf_backend_can_refcount       1
202493
 #define elf_backend_can_gc_sections    1
202493
 #define elf_backend_plt_readonly       1
202493
diff -rup binutils.orig/bfd/elfxx-aarch64.c binutils-2.30/bfd/elfxx-aarch64.c
202493
--- binutils.orig/bfd/elfxx-aarch64.c	2020-11-04 14:53:52.138476401 +0000
202493
+++ binutils-2.30/bfd/elfxx-aarch64.c	2020-11-04 14:56:42.276422492 +0000
202493
@@ -660,3 +660,183 @@ _bfd_aarch64_elf_write_core_note (bfd *a
202493
       }
202493
     }
202493
 }
202493
+
202493
+/* Find the first input bfd with GNU property and merge it with GPROP.  If no
202493
+   such input is found, add it to a new section at the last input.  Update
202493
+   GPROP accordingly.  */
202493
+bfd *
202493
+_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info,
202493
+					    uint32_t *gprop)
202493
+{
202493
+  asection *sec;
202493
+  bfd *pbfd;
202493
+  bfd *ebfd = NULL;
202493
+  elf_property *prop;
202493
+
202493
+  uint32_t gnu_prop = *gprop;
202493
+
202493
+  /* Find a normal input file with GNU property note.  */
202493
+  for (pbfd = info->input_bfds;
202493
+       pbfd != NULL;
202493
+       pbfd = pbfd->link.next)
202493
+    if (bfd_get_flavour (pbfd) == bfd_target_elf_flavour
202493
+	&& bfd_count_sections (pbfd) != 0)
202493
+      {
202493
+	ebfd = pbfd;
202493
+
202493
+	if (elf_properties (pbfd) != NULL)
202493
+	  break;
202493
+      }
202493
+
202493
+  /* If ebfd != NULL it is either an input with property note or the last
202493
+     input.  Either way if we have gnu_prop, we should add it (by creating
202493
+     a section if needed).  */
202493
+  if (ebfd != NULL && gnu_prop)
202493
+    {
202493
+      prop = _bfd_elf_get_property (ebfd,
202493
+				    GNU_PROPERTY_AARCH64_FEATURE_1_AND,
202493
+				    4);
202493
+      prop->u.number |= gnu_prop;
202493
+      prop->pr_kind = property_number;
202493
+
202493
+      /* pbfd being NULL implies ebfd is the last input.  Create the GNU
202493
+	 property note section.  */
202493
+      if (pbfd == NULL)
202493
+	{
202493
+	  sec = bfd_make_section_with_flags (ebfd,
202493
+					     NOTE_GNU_PROPERTY_SECTION_NAME,
202493
+					     (SEC_ALLOC
202493
+					      | SEC_LOAD
202493
+					      | SEC_IN_MEMORY
202493
+					      | SEC_READONLY
202493
+					      | SEC_HAS_CONTENTS
202493
+					      | SEC_DATA));
202493
+	  if (sec == NULL)
202493
+	    info->callbacks->einfo (
202493
+	      _("%F%P: failed to create GNU property section\n"));
202493
+
202493
+	  elf_section_type (sec) = SHT_NOTE;
202493
+	}
202493
+    }
202493
+
202493
+  pbfd = _bfd_elf_link_setup_gnu_properties (info);
202493
+
202493
+  if (bfd_link_relocatable (info))
202493
+    return pbfd;
202493
+
202493
+  /* If pbfd has any GNU_PROPERTY_AARCH64_FEATURE_1_AND properties, update
202493
+     gnu_prop accordingly.  */
202493
+  if (pbfd != NULL)
202493
+    {
202493
+      elf_property_list *p;
202493
+
202493
+      /* The property list is sorted in order of type.  */
202493
+      for (p = elf_properties (pbfd); p; p = p->next)
202493
+	{
202493
+	  /* Check for all GNU_PROPERTY_AARCH64_FEATURE_1_AND.  */
202493
+	  if (GNU_PROPERTY_AARCH64_FEATURE_1_AND == p->property.pr_type)
202493
+	    {
202493
+	      gnu_prop = (p->property.u.number
202493
+			  & (GNU_PROPERTY_AARCH64_FEATURE_1_PAC
202493
+			      | GNU_PROPERTY_AARCH64_FEATURE_1_BTI));
202493
+	      break;
202493
+	    }
202493
+	  else if (GNU_PROPERTY_AARCH64_FEATURE_1_AND < p->property.pr_type)
202493
+	    break;
202493
+	}
202493
+    }
202493
+  *gprop = gnu_prop;
202493
+  return pbfd;
202493
+}
202493
+
202493
+/* Define elf_backend_parse_gnu_properties for AArch64.  */
202493
+enum elf_property_kind
202493
+_bfd_aarch64_elf_parse_gnu_properties (bfd *abfd, unsigned int type,
202493
+				       bfd_byte *ptr, unsigned int datasz)
202493
+{
202493
+  elf_property *prop;
202493
+
202493
+  switch (type)
202493
+    {
202493
+    case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
202493
+      if (datasz != 4)
202493
+	{
202493
+	  _bfd_error_handler
202493
+	    ( _("error: %pB: <corrupt AArch64 used size: 0x%x>"),
202493
+	     abfd, datasz);
202493
+	  return property_corrupt;
202493
+	}
202493
+      prop = _bfd_elf_get_property (abfd, type, datasz);
202493
+      /* Combine properties of the same type.  */
202493
+      prop->u.number |= bfd_h_get_32 (abfd, ptr);
202493
+      prop->pr_kind = property_number;
202493
+      break;
202493
+
202493
+    default:
202493
+      return property_ignored;
202493
+    }
202493
+
202493
+  return property_number;
202493
+}
202493
+
202493
+/* Merge AArch64 GNU property BPROP with APROP also accounting for PROP.
202493
+   If APROP isn't NULL, merge it with BPROP and/or PROP.  Vice-versa if BROP
202493
+   isn't NULL.  Return TRUE if there is any update to APROP or if BPROP should
202493
+   be merge with ABFD.  */
202493
+bfd_boolean
202493
+_bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *info
202493
+				       ATTRIBUTE_UNUSED,
202493
+				       bfd *abfd ATTRIBUTE_UNUSED,
202493
+				       elf_property *aprop,
202493
+				       elf_property *bprop,
202493
+				       uint32_t prop)
202493
+{
202493
+  unsigned int orig_number;
202493
+  bfd_boolean updated = FALSE;
202493
+  unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
202493
+
202493
+  switch (pr_type)
202493
+    {
202493
+    case GNU_PROPERTY_AARCH64_FEATURE_1_AND:
202493
+      {
202493
+	if (aprop != NULL && bprop != NULL)
202493
+	  {
202493
+	    orig_number = aprop->u.number;
202493
+	    aprop->u.number = (orig_number & bprop->u.number) | prop;
202493
+	    updated = orig_number != aprop->u.number;
202493
+	    /* Remove the property if all feature bits are cleared.  */
202493
+	    if (aprop->u.number == 0)
202493
+	      aprop->pr_kind = property_remove;
202493
+	    break;
202493
+	  }
202493
+	/* If either is NULL, the AND would be 0 so, if there is
202493
+	   any PROP, asign it to the input that is not NULL.  */
202493
+	if (prop)
202493
+	  {
202493
+	    if (aprop != NULL)
202493
+	      {
202493
+		orig_number = aprop->u.number;
202493
+		aprop->u.number = prop;
202493
+		updated = orig_number != aprop->u.number;
202493
+	      }
202493
+	    else
202493
+	      {
202493
+		bprop->u.number = prop;
202493
+		updated = TRUE;
202493
+	      }
202493
+	  }
202493
+	/* No PROP and BPROP is NULL, so remove APROP.  */
202493
+	else if (aprop != NULL)
202493
+	  {
202493
+	    aprop->pr_kind = property_remove;
202493
+	    updated = TRUE;
202493
+	  }
202493
+      }
202493
+      break;
202493
+
202493
+    default:
202493
+      abort ();
202493
+    }
202493
+
202493
+  return updated;
202493
+}
202493
diff -rup binutils.orig/bfd/elfxx-aarch64.h binutils-2.30/bfd/elfxx-aarch64.h
202493
--- binutils.orig/bfd/elfxx-aarch64.h	2020-11-04 14:53:52.134476424 +0000
202493
+++ binutils-2.30/bfd/elfxx-aarch64.h	2020-11-04 14:56:42.276422492 +0000
202493
@@ -65,3 +65,19 @@ _bfd_aarch64_elf_write_core_note (bfd *,
202493
 #define elf_backend_grok_prstatus	_bfd_aarch64_elf_grok_prstatus
202493
 #define elf_backend_grok_psinfo		_bfd_aarch64_elf_grok_psinfo
202493
 #define elf_backend_write_core_note	_bfd_aarch64_elf_write_core_note
202493
+
202493
+extern bfd *
202493
+_bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *,
202493
+					    uint32_t *);
202493
+
202493
+extern enum elf_property_kind
202493
+_bfd_aarch64_elf_parse_gnu_properties (bfd *, unsigned int,
202493
+				       bfd_byte *, unsigned int);
202493
+
202493
+extern bfd_boolean
202493
+_bfd_aarch64_elf_merge_gnu_properties (struct bfd_link_info *, bfd *,
202493
+				       elf_property *, elf_property *,
202493
+				       uint32_t);
202493
+
202493
+#define elf_backend_parse_gnu_properties	\
202493
+  _bfd_aarch64_elf_parse_gnu_properties
202493
diff -rup binutils.orig/binutils/readelf.c binutils-2.30/binutils/readelf.c
202493
--- binutils.orig/binutils/readelf.c	2020-11-04 14:53:51.723478764 +0000
202493
+++ binutils-2.30/binutils/readelf.c	2020-11-04 14:56:42.277422485 +0000
202493
@@ -17103,6 +17103,33 @@ decode_x86_feature_2 (unsigned int bitma
202493
 }
202493
 
202493
 static void
202493
+decode_aarch64_feature_1_and (unsigned int bitmask)
202493
+{
202493
+  while (bitmask)
202493
+    {
202493
+      unsigned int bit = bitmask & (- bitmask);
202493
+
202493
+      bitmask &= ~ bit;
202493
+      switch (bit)
202493
+	{
202493
+	case GNU_PROPERTY_AARCH64_FEATURE_1_BTI:
202493
+	  printf ("BTI");
202493
+	  break;
202493
+
202493
+	case GNU_PROPERTY_AARCH64_FEATURE_1_PAC:
202493
+	  printf ("PAC");
202493
+	  break;
202493
+
202493
+	default:
202493
+	  printf (_("<unknown: %x>"), bit);
202493
+	  break;
202493
+	}
202493
+      if (bitmask)
202493
+	printf (", ");
202493
+    }
202493
+}
202493
+
202493
+static void
202493
 print_gnu_property_note (Filedata * filedata, Elf_Internal_Note * pnote)
202493
 {
202493
   unsigned char * ptr = (unsigned char *) pnote->descdata;
202493
@@ -17236,6 +17263,18 @@ print_gnu_property_note (Filedata * file
202493
 		  break;
202493
 		}
202493
 	    }
202493
+	  else if (filedata->file_header.e_machine == EM_AARCH64)
202493
+	    {
202493
+	      if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND)
202493
+		{
202493
+		  printf ("AArch64 feature: ");
202493
+		  if (datasz != 4)
202493
+		    printf (_("<corrupt length: %#x> "), datasz);
202493
+		  else
202493
+		    decode_aarch64_feature_1_and (byte_get (ptr, 4));
202493
+		  goto next;
202493
+		}
202493
+	    }
202493
 	}
202493
       else
202493
 	{
202493
diff -rup binutils.orig/include/elf/common.h binutils-2.30/include/elf/common.h
202493
--- binutils.orig/include/elf/common.h	2020-11-04 14:53:52.155476304 +0000
202493
+++ binutils-2.30/include/elf/common.h	2020-11-04 14:56:42.277422485 +0000
202493
@@ -832,6 +832,12 @@
202493
 #define GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT	(1U << 8)
202493
 #define GNU_PROPERTY_X86_FEATURE_2_XSAVEC	(1U << 9)
202493
 
202493
+/* AArch64 specific GNU PROPERTY.  */
202493
+#define GNU_PROPERTY_AARCH64_FEATURE_1_AND	0xc0000000
202493
+
202493
+#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI	(1U << 0)
202493
+#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC	(1U << 1)
202493
+
202493
 /* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG).  */
202493
 #define GNU_ABI_TAG_LINUX	0
202493
 #define GNU_ABI_TAG_HURD	1
202493
diff -rup binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp binutils-2.30/ld/testsuite/ld-aarch64/aarch64-elf.exp
202493
--- binutils.orig/ld/testsuite/ld-aarch64/aarch64-elf.exp	2020-11-04 14:53:51.843478081 +0000
202493
+++ binutils-2.30/ld/testsuite/ld-aarch64/aarch64-elf.exp	2020-11-04 14:56:42.278422479 +0000
202493
@@ -337,6 +337,10 @@ run_dump_test_lp64 "variant_pcs-r"
202493
 run_dump_test_lp64 "variant_pcs-shared"
202493
 run_dump_test_lp64 "variant_pcs-now"
202493
 
202493
+run_dump_test "property-bti-pac1"
202493
+run_dump_test "property-bti-pac2"
202493
+run_dump_test "property-bti-pac3"
202493
+
202493
 set aarch64elflinktests {
202493
   {"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
202493
     {} "copy-reloc-so.so"}
202493
--- /dev/null	2020-11-04 08:04:13.849482156 +0000
202493
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d	2020-11-04 14:56:42.278422479 +0000
202493
@@ -0,0 +1,11 @@
202493
+#name: GNU Property (single input, combine section)
202493
+#source: property-bti-pac1.s
202493
+#as: -march=armv8.5-a -defsym __mult__=0
202493
+#ld: -shared
202493
+#readelf: -n
202493
+#target: *linux*
202493
+
202493
+Displaying notes found in: .note.gnu.property
202493
+  Owner                 Data size	Description
202493
+  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0
202493
+      Properties: AArch64 feature: BTI, PAC
202493
--- /dev/null	2020-11-04 08:04:13.849482156 +0000
202493
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.s	2020-11-04 14:56:42.278422479 +0000
202493
@@ -0,0 +1,37 @@
202493
+	.text
202493
+	.globl _start
202493
+	.type _start,@function
202493
+_start:
202493
+	mov x1, #2
202493
+.ifndef __mult__
202493
+	bl foo
202493
+.endif
202493
+	.section ".note.gnu.property", "a"
202493
+	.p2align 3
202493
+	.long 1f - 0f		/* name length */
202493
+	.long 5f - 2f		/* data length */
202493
+	.long 5			/* note type */
202493
+0:	.asciz "GNU"		/* vendor name */
202493
+1:
202493
+	.p2align 3
202493
+2:	.long 0xc0000000	/* pr_type.  */
202493
+	.long 4f - 3f		/* pr_datasz.  */
202493
+3:
202493
+	.long 0x2		/* PAC.  */
202493
+4:
202493
+	.p2align 3
202493
+5:
202493
+	.p2align 3
202493
+	.long 1f - 0f		/* name length */
202493
+	.long 5f - 2f		/* data length */
202493
+	.long 5			/* note type */
202493
+0:	.asciz "GNU"		/* vendor name */
202493
+1:
202493
+	.p2align 3
202493
+2:	.long 0xc0000000	/* pr_type.  */
202493
+	.long 4f - 3f		/* pr_datasz.  */
202493
+3:
202493
+	.long 0x1		/* BTI.  */
202493
+4:
202493
+	.p2align 3
202493
+5:
202493
--- /dev/null	2020-11-04 08:04:13.849482156 +0000
202493
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac2.s	2020-11-04 14:56:42.278422479 +0000
202493
@@ -0,0 +1,50 @@
202493
+	.text
202493
+	.global	foo
202493
+	.type	foo, %function
202493
+foo:
202493
+	sub	sp, sp, #16
202493
+	mov	w0, 9
202493
+	str	w0, [sp, 12]
202493
+	ldr	w0, [sp, 12]
202493
+	add	w0, w0, 4
202493
+	str	w0, [sp, 12]
202493
+	nop
202493
+	add	sp, sp, 16
202493
+	ret
202493
+	.size	foo, .-foo
202493
+	.global	bar
202493
+	.type	bar, %function
202493
+.ifdef __property_bti__
202493
+	.section ".note.gnu.property", "a"
202493
+	.p2align 3
202493
+	.long 1f - 0f		/* name length */
202493
+	.long 5f - 2f		/* data length */
202493
+	.long 5			/* note type */
202493
+0:	.asciz "GNU"		/* vendor name */
202493
+1:
202493
+	.p2align 3
202493
+2:	.long 0xc0000000	/* pr_type.  */
202493
+	.long 4f - 3f		/* pr_datasz.  */
202493
+3:
202493
+	.long 0x1		/* BTI.  */
202493
+4:
202493
+	.p2align 3
202493
+5:
202493
+.endif
202493
+.ifdef __property_pac__
202493
+	.section ".note.gnu.property", "a"
202493
+	.p2align 3
202493
+	.long 1f - 0f		/* name length */
202493
+	.long 5f - 2f		/* data length */
202493
+	.long 5			/* note type */
202493
+0:	.asciz "GNU"		/* vendor name */
202493
+1:
202493
+	.p2align 3
202493
+2:	.long 0xc0000000	/* pr_type.  */
202493
+	.long 4f - 3f		/* pr_datasz.  */
202493
+3:
202493
+	.long 0x2		/* PAC.  */
202493
+4:
202493
+	.p2align 3
202493
+5:
202493
+.endif
202493
--- /dev/null	2020-11-04 08:04:13.849482156 +0000
202493
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac2.d	2020-11-04 14:56:42.278422479 +0000
202493
@@ -0,0 +1,12 @@
202493
+#name: GNU Property (combine multiple with BTI)
202493
+#source: property-bti-pac1.s
202493
+#source: property-bti-pac2.s
202493
+#as: -mabi=lp64 -defsym __property_bti__=1
202493
+#ld: -e _start
202493
+#readelf: -n
202493
+#target: *linux*
202493
+
202493
+Displaying notes found in: .note.gnu.property
202493
+  Owner                 Data size	Description
202493
+  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0
202493
+      Properties: AArch64 feature: BTI
202493
--- /dev/null	2020-11-04 08:04:13.849482156 +0000
202493
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac3.d	2020-11-04 14:56:42.278422479 +0000
202493
@@ -0,0 +1,12 @@
202493
+#name: GNU Property (combine multiple with PAC)
202493
+#source: property-bti-pac1.s
202493
+#source: property-bti-pac2.s
202493
+#as: -mabi=lp64 -defsym __property_pac__=1
202493
+#ld: -e _start
202493
+#readelf: -n
202493
+#target: *linux*
202493
+
202493
+Displaying notes found in: .note.gnu.property
202493
+  Owner                 Data size	Description
202493
+  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0
202493
+      Properties: AArch64 feature: PAC
202493
diff -rup binutils.orig/bfd/elfnn-aarch64.c binutils-2.30/bfd/elfnn-aarch64.c
202493
--- binutils.orig/bfd/elfnn-aarch64.c	2020-11-25 11:53:26.648275978 +0000
202493
+++ binutils-2.30/bfd/elfnn-aarch64.c	2020-11-25 12:21:39.276864970 +0000
202493
@@ -9331,12 +9331,14 @@ elfNN_aarch64_link_setup_gnu_properties
202493
    for the effect of GNU properties of the output_bfd.  */
202493
 static bfd_boolean
202493
 elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
202493
-				       bfd *abfd,
202493
-				       elf_property *aprop,
202493
-				       elf_property *bprop)
202493
+				    bfd *abfd,
202493
+				    bfd *bbfd ATTRIBUTE_UNUSED,
202493
+				    elf_property *aprop,
202493
+				    elf_property *bprop)
202493
 {
202493
   uint32_t prop
202493
     = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
202493
+
202493
   return  _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
202493
 						 bprop, prop);
202493
 }
202493
diff -rup binutils.orig/bfd/elfxx-aarch64.c binutils-2.30/bfd/elfxx-aarch64.c
202493
--- binutils.orig/bfd/elfxx-aarch64.c	2020-11-25 11:53:26.655275930 +0000
202493
+++ binutils-2.30/bfd/elfxx-aarch64.c	2020-11-25 12:21:34.689895875 +0000
202493
@@ -22,6 +22,7 @@
202493
 #include "elfxx-aarch64.h"
202493
 #include <stdarg.h>
202493
 #include <string.h>
202493
+#include "libbfd.h"
202493
 
202493
 #define MASK(n) ((1u << (n)) - 1)
202493
 
202493
@@ -835,7 +836,10 @@ _bfd_aarch64_elf_merge_gnu_properties (s
202493
       break;
202493
 
202493
     default:
202493
-      abort ();
202493
+      _bfd_error_handler
202493
+	( _("error: %pB: <corrupt AArch64 property note: 0x%x>"),
202493
+	  abfd, pr_type);
202493
+      return FALSE;
202493
     }
202493
 
202493
   return updated;
202493
diff -rup binutils.orig/ld/testsuite/ld-aarch64/property-bti-pac1.d binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d
202493
--- binutils.orig/ld/testsuite/ld-aarch64/property-bti-pac1.d	2020-11-25 11:53:26.344278044 +0000
202493
+++ binutils-2.30/ld/testsuite/ld-aarch64/property-bti-pac1.d	2020-11-25 11:57:53.179471900 +0000
202493
@@ -1,6 +1,6 @@
202493
 #name: GNU Property (single input, combine section)
202493
 #source: property-bti-pac1.s
202493
-#as: -march=armv8.5-a -defsym __mult__=0
202493
+#as: -defsym __mult__=0
202493
 #ld: -shared
202493
 #readelf: -n
202493
 #target: *linux*