PATCH [1/4] arm: Add Tag_PAC_extension build attribute

Andrea Corallo andrea.corallo@arm.com
Mon Jul 26 12:36:46 GMT 2021


Hi all,

first patch of the series adding 'Tag_PAC_extension' build attribute
support.

Here follows its semantic:

  0 The user did not permit this entity to use PAC/AUT instructions
  1 The user permitted this entity to use PAC/AUT instructions in the NOP space
  2 The user permitted this entity to use PAC/AUT instructions in the NOP and in
    the non-NOP.

See:
- Armv8.1-M Pointer Authentication and Branch Target Identification Extension [1]
- Armv8-M Architecture Reference Manual [2]

Regtested clean on current master.

Best Regards

  Andrea

[1] <https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension>
[2] <https://developer.arm.com/documentation/ddi0553/latest>

-------------- next part --------------
>From d79e409a61407048d45770a55afd3df02762d00f Mon Sep 17 00:00:00 2001
From: Andrea Corallo <andrea.corallo@arm.com>
Date: Wed, 30 Jun 2021 09:37:12 +0200
Subject: [PATCH 1/4] PATCH [1/4] arm: Add Tag_PAC_extension build attribute

bfd/
2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>

	* elf32-arm.c (elf32_arm_merge_eabi_attributes): Add
	'Tag_PAC_extension' case.

binutils/
2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>

	* readelf.c (arm_attr_tag_PAC_extension): Declare.
	(arm_attr_public_tags): Add 'PAC_extension' lookup.

elfcpp/
2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>

	* arm.h: Define 'Tag_PAC_extension' enum.

gas/
2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>

	* config/tc-arm.c (arm_convert_symbolic_attribute): Add
	'Tag_PAC_extension' to the attribute_table.

include/
2021-07-06  Andrea Corallo  <andrea.corallo@arm.com>

	* elf/arm.h (elf_arm_reloc_type): Add 'Tag_PAC_extension'.
---
 bfd/elf32-arm.c     | 1 +
 binutils/readelf.c  | 6 ++++++
 elfcpp/arm.h        | 1 +
 gas/config/tc-arm.c | 1 +
 include/elf/arm.h   | 1 +
 5 files changed, 10 insertions(+)

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index a9119c49780..bb4ba89357e 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -14612,6 +14612,7 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
 	case Tag_T2EE_use:
 	case Tag_MPextension_use:
 	case Tag_MVE_arch:
+	case Tag_PAC_extension:
 	  /* Use the largest value specified.  */
 	  if (in_attr[i].i > out_attr[i].i)
 	    out_attr[i].i = in_attr[i].i;
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 5682837ed7b..cccc17afc3f 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -16139,6 +16139,11 @@ static const char *const arm_attr_tag_MPextension_use_legacy[] =
 static const char *const arm_attr_tag_MVE_arch[] =
   {"No MVE", "MVE Integer only", "MVE Integer and FP"};
 
+static const char * arm_attr_tag_PAC_extension[] =
+  {"No PAC/AUT instructions",
+   "PAC/AUT instructions permitted in the NOP space",
+   "PAC/AUT instructions permitted in the NOP and in the non-NOP space"};
+
 #define LOOKUP(id, name) \
   {id, #name, 0x80 | ARRAY_SIZE(arm_attr_tag_##name), arm_attr_tag_##name}
 static arm_attr_public_tag arm_attr_public_tags[] =
@@ -16179,6 +16184,7 @@ static arm_attr_public_tag arm_attr_public_tags[] =
   LOOKUP(44, DIV_use),
   LOOKUP(46, DSP_extension),
   LOOKUP(48, MVE_arch),
+  LOOKUP(50, PAC_extension),
   {64, "nodefaults", 0, NULL},
   {65, "also_compatible_with", 0, NULL},
   LOOKUP(66, T2EE_use),
diff --git a/elfcpp/arm.h b/elfcpp/arm.h
index 1d3102ff748..ce682a5bdc6 100644
--- a/elfcpp/arm.h
+++ b/elfcpp/arm.h
@@ -306,6 +306,7 @@ enum
   Tag_undefined43 = 43,
   Tag_DIV_use = 44,
   Tag_MVE_arch = 48,
+  Tag_PAC_extension = 50,
   Tag_nodefaults = 64,
   Tag_also_compatible_with = 65,
   Tag_T2EE_use = 66,
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index c9e65582b17..9213134eb55 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -33559,6 +33559,7 @@ arm_convert_symbolic_attribute (const char *name)
       T (Tag_Virtualization_use),
       T (Tag_DSP_extension),
       T (Tag_MVE_arch),
+      T (Tag_PAC_extension),
       /* We deliberately do not include Tag_MPextension_use_legacy.  */
 #undef T
     };
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 5b6e403dd28..27b676860dd 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -327,6 +327,7 @@ enum
   Tag_DIV_use,
   Tag_DSP_extension = 46,
   Tag_MVE_arch = 48,
+  Tag_PAC_extension = 50,
   Tag_nodefaults = 64,
   Tag_also_compatible_with,
   Tag_T2EE_use,
-- 
2.20.1



More information about the Binutils mailing list