public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][GAS] arm: add armv9-a architecture to -march
@ 2021-10-04 20:24 Przemyslaw Wirkus
  2021-10-12  9:10 ` Przemyslaw Wirkus
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Przemyslaw Wirkus @ 2021-10-04 20:24 UTC (permalink / raw)
  To: Binutils; +Cc: Richard Earnshaw, Marcus Shawcroft, nickc

[-- Attachment #1: Type: text/plain, Size: 2990 bytes --]

Patch is adding `armv9-a` to -march in Arm GAS.

This patch also updates:
	+ New value of Tag_CPU_arch EABI attribute (22) is added, see [0].
	+ Updated missing from code Tag_CPU_arch EABI attributes for
	  "Arm v8.1-A", "Arm v8.2-A" and "Arm v8.3-A" entries, see [0].
	+ New test `armv9-a_arch.d` to demonstrate that (22) is recognised
	  by readelf.
	+ Commit [1] extends arm_feature_set.core array. A follow up change
	  is done to e.g., initialize (with 0s) or other values existing
	  ARM_FEATURE_x macros. New macro ARM_FEATURE_ALL is added set all
	  fields of arm_feature_set.core array.
	+ Various changes are made to align asserts with new V9 arch.
	+ Updated how we combine archs 'v4t_plus_v6_m' as this mechanism
	must handle new Armv9 as well.

	[0] https://github.com/ARM-software/abi-aa/blob/main/addenda32/addenda32.rst#3352the-target-related-attributes
	[1] 2c6ccfcfdde1 (arm: Extend again arm_feature_set struct to provide
	    more bits).

Regression tested on `arm-none-eabi` cross Binutils and no issues.

OK for master?

bfd/

2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* archures.c: Define bfd_mach_arm_9.
	* bfd-in2.h (bfd_mach_arm_9): Define bfd_mach_arm_9.
	* cpu-arm.c: Add 'armv9-a' option to -march.
	* elf32-arm.c (using_thumb2_bl): Update assert check.
	(arch_has_arm_nop): Add TAG_CPU_ARCH_V9.
	(bfd_arm_get_mach_from_attributes): Add case for TAG_CPU_ARCH_V9.
	Update assert.
	(tag_cpu_arch_combine): Updated table.
	(tag_cpu_arch_combine): Updated table.
	(tag_cpu_arch_combine): Updated table.
	(v9): New table..

binutils/

2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* readelf.c (arm_attr_tag_CPU_arch): Update with 

elfcpp/

2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* arm.h: Update TAG_CPU_ARCH_ enums with currect values.

gas/

2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* NEWS: Update docs.
	* config/tc-arm.c (get_aeabi_cpu_arch_from_fset): Return Armv9-a
	for -amarch=all.
	(aeabi_set_public_attributes): Update assert.
	* doc/c-arm.texi: Update docs.
	* testsuite/gas/arm/armv9-a_arch.d: New test.
	* testsuite/gas/arm/attr-march-all.d: Update test with v9.

include/

2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* elf/arm.h Update TAG_CPU_ARCH_ defines with currect values.
	* opcode/arm.h (ARM_EXT3_V9A): New macro.
	(ARM_ARCH_NONE): Updated with arm_feature_set.core size.
	(FPU_NONE): Updated.
	(ARM_ANY): Updated.
	(ARM_ARCH_UNKNOWN): New macro.
	(ARM_FEATURE_LOW): Updated.
	(ARM_FEATURE_CORE): Updated.
	(ARM_FEATURE_CORE_LOW): Updated.
	(ARM_FEATURE_CORE_HIGH): Updated.
	(ARM_FEATURE_COPROC): Updated.
	(ARM_FEATURE): Updated.
	(ARM_FEATURE_ALL): New macro.

opcodes/

2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>

	* arm-dis.c (select_arm_features): Support bfd_mach_arm_9.
	Also Update bfd_mach_arm_unknown to use new macro ARM_ARCH_UNKNOWN.

[-- Attachment #2: rb14867.patch --]
[-- Type: application/octet-stream, Size: 16710 bytes --]

diff --git a/bfd/archures.c b/bfd/archures.c
index 31a41a1d863a4b14c828a736973fe84dd834b70d..289046f922e968dacd33b53835c01a73b017b6a3 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -337,6 +337,7 @@ DESCRIPTION
 .#define bfd_mach_arm_8M_BASE   25
 .#define bfd_mach_arm_8M_MAIN   26
 .#define bfd_mach_arm_8_1M_MAIN 27
+.#define bfd_mach_arm_9         28
 .  bfd_arch_nds32,     {* Andes NDS32.  *}
 .#define bfd_mach_n1		1
 .#define bfd_mach_n1h		2
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index a0faeafc3dc9f6a645f373b5dcf1b84a6160c0c6..29921d0c6babec53182e08c5a5c4c6279a216e47 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1719,6 +1719,7 @@ enum bfd_architecture
 #define bfd_mach_arm_8M_BASE   25
 #define bfd_mach_arm_8M_MAIN   26
 #define bfd_mach_arm_8_1M_MAIN 27
+#define bfd_mach_arm_9         28
   bfd_arch_nds32,     /* Andes NDS32.  */
 #define bfd_mach_n1            1
 #define bfd_mach_n1h           2
diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c
index 7a1ed46f5d4cc043282a9a52fa6a37efb70f3a61..c8706253df13262b67bcb70aa6b431e53c6baaab 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -258,6 +258,7 @@ static const bfd_arch_info_type arch_info_struct[] =
   N (bfd_mach_arm_8M_BASE,   "armv8-m.base",   false, & arch_info_struct[25]),
   N (bfd_mach_arm_8M_MAIN,   "armv8-m.main",   false, & arch_info_struct[26]),
   N (bfd_mach_arm_8_1M_MAIN, "armv8.1-m.main", false, & arch_info_struct[27]),
+  N (bfd_mach_arm_9,         "armv9-a",        false, & arch_info_struct[28]),
   N (bfd_mach_arm_unknown,   "arm_any",        false, NULL)
 };
 
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 2cb8768868b30ce1a228f8bd73e4e416b9de4b9b..1655d52e2844e070e0baa2bd03af4a6f835283c8 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -3941,7 +3941,7 @@ using_thumb2_bl (struct elf32_arm_link_hash_table *globals)
     bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC, Tag_CPU_arch);
 
   /* Force return logic to be reviewed for each new architecture.  */
-  BFD_ASSERT (arch <= TAG_CPU_ARCH_V8_1M_MAIN);
+  BFD_ASSERT (arch <= TAG_CPU_ARCH_V9);
 
   /* Architecture was introduced after ARMv6T2 (eg. ARMv6-M).  */
   return (arch == TAG_CPU_ARCH_V6T2
@@ -4130,13 +4130,14 @@ arch_has_arm_nop (struct elf32_arm_link_hash_table *globals)
 					     Tag_CPU_arch);
 
   /* Force return logic to be reviewed for each new architecture.  */
-  BFD_ASSERT (arch <= TAG_CPU_ARCH_V8_1M_MAIN);
+  BFD_ASSERT (arch <= TAG_CPU_ARCH_V9);
 
   return (arch == TAG_CPU_ARCH_V6T2
 	  || arch == TAG_CPU_ARCH_V6K
 	  || arch == TAG_CPU_ARCH_V7
 	  || arch == TAG_CPU_ARCH_V8
-	  || arch == TAG_CPU_ARCH_V8R);
+	  || arch == TAG_CPU_ARCH_V8R
+	  || arch == TAG_CPU_ARCH_V9);
 }
 
 static bool
@@ -13852,6 +13853,8 @@ bfd_arm_get_mach_from_attributes (bfd * abfd)
 	return bfd_mach_arm_8M_MAIN;
     case TAG_CPU_ARCH_V8_1M_MAIN:
 	return bfd_mach_arm_8_1M_MAIN;
+    case TAG_CPU_ARCH_V9:
+	return bfd_mach_arm_9;
 
     default:
       /* Force entry to be added for any new known Tag_CPU_arch value.  */
@@ -14202,7 +14205,14 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
       T(V8),		/* V6_M.  */
       T(V8),		/* V6S_M.  */
       T(V8),		/* V7E_M.  */
-      T(V8)		/* V8.  */
+      T(V8),		/* V8.  */
+      T(V8),		/* V8-R.  */
+      T(V8),		/* V8-M.BASE.  */
+      T(V8),		/* V8-M.MAIN.  */
+      T(V8),		/* V8.1.  */
+      T(V8),		/* V8.2.  */
+      T(V8),		/* V8.3.  */
+      T(V8),		/* V8.1-M.MAIN.  */
     };
   const int v8r[] =
     {
@@ -14289,6 +14299,32 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
       -1,		/* Unused (20).  */
       T(V8_1M_MAIN)	/* V8.1-M MAINLINE.  */
     };
+  const int v9[] =
+    {
+      T(V9),		/* PRE_V4.  */
+      T(V9),		/* V4.  */
+      T(V9),		/* V4T.  */
+      T(V9),		/* V5T.  */
+      T(V9),		/* V5TE.  */
+      T(V9),		/* V5TEJ.  */
+      T(V9),		/* V6.  */
+      T(V9),		/* V6KZ.  */
+      T(V9),		/* V6T2.  */
+      T(V9),		/* V6K.  */
+      T(V9),		/* V7.  */
+      T(V9),		/* V6_M.  */
+      T(V9),		/* V6S_M.  */
+      T(V9),		/* V7E_M.  */
+      T(V9),		/* V8.  */
+      T(V9),		/* V8-R.  */
+      T(V9),		/* V8-M.BASE.  */
+      T(V9),		/* V8-M.MAIN.  */
+      T(V9),		/* V8.1.  */
+      T(V9),		/* V8.2.  */
+      T(V9),		/* V8.3.  */
+      T(V9),		/* V8.1-M.MAIN.  */
+      T(V9),		/* V9.  */
+     };
   const int v4t_plus_v6_m[] =
     {
       -1,		/* PRE_V4.  */
@@ -14313,6 +14349,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
       -1,		/* Unused (19).  */
       -1,		/* Unused (20).  */
       T(V8_1M_MAIN),	/* V8.1-M MAINLINE.  */
+      T(V9),		/* V9.  */
       T(V4T_PLUS_V6_M)	/* V4T plus V6_M.  */
     };
   const int *comb[] =
@@ -14331,6 +14368,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
       NULL,
       NULL,
       v8_1m_mainline,
+      v9,
       /* Pseudo-architecture.  */
       v4t_plus_v6_m
     };
@@ -14547,10 +14585,16 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
 		"ARM v7",
 		"ARM v6-M",
 		"ARM v6S-M",
+		"ARM v7E-M",
 		"ARM v8",
-		"",
+		"ARM v8-R",
 		"ARM v8-M.baseline",
 		"ARM v8-M.mainline",
+		"ARM v8.1-A",
+		"ARM v8.2-A",
+		"ARM v8.3-A",
+		"ARM v8.1-M.mainline",
+		"ARM v9",
 	    };
 
 	    /* Merge Tag_CPU_arch and Tag_also_compatible_with.  */
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 3b6f1a3ab1d1a8903e0a4975568ec199b9031ae0..ec30cdc846ad8dcad58c18488acd486229865fd7 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -16072,7 +16072,8 @@ typedef struct
 static const char *const arm_attr_tag_CPU_arch[] =
   {"Pre-v4", "v4", "v4T", "v5T", "v5TE", "v5TEJ", "v6", "v6KZ", "v6T2",
    "v6K", "v7", "v6-M", "v6S-M", "v7E-M", "v8", "v8-R", "v8-M.baseline",
-   "v8-M.mainline", "", "", "", "v8.1-M.mainline"};
+   "v8-M.mainline", "v8.1-A", "v8.2-A", "v8.3-A",
+   "v8.1-M.mainline", "v9"};
 static const char *const arm_attr_tag_ARM_ISA_use[] = {"No", "Yes"};
 static const char *const arm_attr_tag_THUMB_ISA_use[] =
   {"No", "Thumb-1", "Thumb-2", "Yes"};
diff --git a/elfcpp/arm.h b/elfcpp/arm.h
index db549a8ee68b7e90b9b569110555d5cb9ee6ced7..65374bb41ee701d44799222ec8e52ae430bf3497 100644
--- a/elfcpp/arm.h
+++ b/elfcpp/arm.h
@@ -254,7 +254,15 @@ enum
   TAG_CPU_ARCH_V6S_M,
   TAG_CPU_ARCH_V7E_M,
   TAG_CPU_ARCH_V8,
-  MAX_TAG_CPU_ARCH = TAG_CPU_ARCH_V8,
+  TAG_CPU_ARCH_V8R,
+  TAG_CPU_ARCH_V8M_BASE,
+  TAG_CPU_ARCH_V8M_MAIN,
+  TAG_CPU_ARCH_8_1A,
+  TAG_CPU_ARCH_8_2A,
+  TAG_CPU_ARCH_8_3A,
+  TAG_CPU_ARCH_V8_1M_MAIN,
+  TAG_CPU_ARCH_V9,
+  MAX_TAG_CPU_ARCH = TAG_CPU_ARCH_V9,
   // Pseudo-architecture to allow objects to be compatible with the subset of
   // armv4t and armv6-m.  This value should never be stored in object files.
   TAG_CPU_ARCH_V4T_PLUS_V6_M = (MAX_TAG_CPU_ARCH + 1)
diff --git a/gas/NEWS b/gas/NEWS
index 5de205ecd5531a49fd42248b287d8f520018cd8e..db102bee72733a57356b76d0468ca20b2852f40e 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -10,6 +10,8 @@
 
 * Add support for 'armv9-a' for -march in AArch64 GAS.
 
+* Add support for 'armv9-a' for -march in Arm GAS.
+
 * Add support for Intel AVX512_FP16 instructions.
 
 Changes in 2.37:
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index f77165513d917c16d1efedab740929826b37a3b0..5b721c3b2ccd607be1dd4fb6592e587d01ba2938 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -31891,6 +31891,21 @@ static const struct arm_ext_table armv86a_ext_table[] =
   { NULL, 0, ARM_ARCH_NONE, ARM_ARCH_NONE }
 };
 
+static const struct arm_ext_table armv9a_ext_table[] =
+{
+  ARM_ADD ("simd", FPU_ARCH_DOTPROD_NEON_VFP_ARMV8),
+  ARM_ADD ("fp16", FPU_ARCH_NEON_VFP_ARMV8_4_FP16FML),
+  ARM_ADD ("bf16", ARM_FEATURE_CORE_HIGH (ARM_EXT2_BF16)),
+  ARM_ADD ("i8mm", ARM_FEATURE_CORE_HIGH (ARM_EXT2_I8MM)),
+  ARM_EXT ("crypto", FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_4,
+	   ARM_FEATURE_COPROC (FPU_CRYPTO_ARMV8)),
+
+  /* Armv9-a does not allow an FP implementation without SIMD, so the user
+     should use the +simd option to turn on FP.  */
+  ARM_REMOVE ("fp", ALL_FP),
+  { NULL, 0, ARM_ARCH_NONE, ARM_ARCH_NONE }
+};
+
 #define CDE_EXTENSIONS \
   ARM_ADD ("cdecp0", ARM_FEATURE_CORE_HIGH (ARM_EXT2_CDE | ARM_EXT2_CDE0)), \
   ARM_ADD ("cdecp1", ARM_FEATURE_CORE_HIGH (ARM_EXT2_CDE | ARM_EXT2_CDE1)), \
@@ -32013,6 +32028,7 @@ static const struct arm_arch_option_table arm_archs[] =
   ARM_ARCH_OPT2 ("armv8.4-a",	  ARM_ARCH_V8_4A,	FPU_ARCH_VFP, armv84a),
   ARM_ARCH_OPT2 ("armv8.5-a",	  ARM_ARCH_V8_5A,	FPU_ARCH_VFP, armv85a),
   ARM_ARCH_OPT2 ("armv8.6-a",	  ARM_ARCH_V8_6A,	FPU_ARCH_VFP, armv86a),
+  ARM_ARCH_OPT2 ("armv9-a",	  ARM_ARCH_V9A,	FPU_ARCH_VFP, armv9a),
   ARM_ARCH_OPT ("xscale",	  ARM_ARCH_XSCALE,	FPU_ARCH_VFP),
   ARM_ARCH_OPT ("iwmmxt",	  ARM_ARCH_IWMMXT,	FPU_ARCH_VFP),
   ARM_ARCH_OPT ("iwmmxt2",	  ARM_ARCH_IWMMXT2,	FPU_ARCH_VFP),
@@ -32796,6 +32812,7 @@ static const cpu_arch_ver_table cpu_arch_ver[] =
     {TAG_CPU_ARCH_V8,	      ARM_ARCH_V8_5A},
     {TAG_CPU_ARCH_V8_1M_MAIN, ARM_ARCH_V8_1M_MAIN},
     {TAG_CPU_ARCH_V8,	    ARM_ARCH_V8_6A},
+    {TAG_CPU_ARCH_V9,	    ARM_ARCH_V9A},
     {-1,		    ARM_ARCH_NONE}
 };
 
@@ -32879,9 +32896,9 @@ get_aeabi_cpu_arch_from_fset (const arm_feature_set *arch_ext_fset,
   if (ARM_FEATURE_EQUAL (*arch_ext_fset, arm_arch_any))
     {
       /* Force revisiting of decision for each new architecture.  */
-      gas_assert (MAX_TAG_CPU_ARCH <= TAG_CPU_ARCH_V8_1M_MAIN);
+      gas_assert (MAX_TAG_CPU_ARCH <= TAG_CPU_ARCH_V9);
       *profile = 'A';
-      return TAG_CPU_ARCH_V8;
+      return TAG_CPU_ARCH_V9;
     }
 
   ARM_CLEAR_FEATURE (arch_fset, *arch_ext_fset, *ext_fset);
@@ -33157,7 +33174,7 @@ aeabi_set_public_attributes (void)
      by the base architecture.
 
      For new architectures we will have to check these tests.  */
-  gas_assert (arch <= TAG_CPU_ARCH_V8_1M_MAIN);
+  gas_assert (arch <= TAG_CPU_ARCH_V9);
   if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v8)
       || ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m))
     aeabi_set_attribute_int (Tag_DIV_use, 0);
diff --git a/gas/doc/c-arm.texi b/gas/doc/c-arm.texi
index d387debec43e81a0a64c94c1de16023a103a0a03..4baa46d3083bbde6df7f29122477f8390faf6771 100644
--- a/gas/doc/c-arm.texi
+++ b/gas/doc/c-arm.texi
@@ -264,6 +264,7 @@ names are recognized:
 @code{armv8-m.main},
 @code{armv8.1-m.main},
 @code{armv8.6-a},
+@code{armv9-a},
 @code{iwmmxt},
 @code{iwmmxt2}
 and
diff --git a/gas/testsuite/gas/arm/armv9-a_arch.d b/gas/testsuite/gas/arm/armv9-a_arch.d
new file mode 100644
index 0000000000000000000000000000000000000000..52c8bb0c15fd877c351b0d3d2ebb575f868cc7d6
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv9-a_arch.d
@@ -0,0 +1,17 @@
+# name: check for armv9-a command line option settings
+# source: blank.s
+# as: -march=armv9-a
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+  Tag_CPU_name: "9-A"
+  Tag_CPU_arch: v9
+  Tag_CPU_arch_profile: Application
+  Tag_ARM_ISA_use: Yes
+  Tag_THUMB_ISA_use: Thumb-2
+  Tag_Advanced_SIMD_arch: NEON for ARMv8.1
+  Tag_MPextension_use: Allowed
+  Tag_Virtualization_use: TrustZone and Virtualization Extensions
diff --git a/gas/testsuite/gas/arm/attr-march-all.d b/gas/testsuite/gas/arm/attr-march-all.d
index e04d98c9fa1273a67597aabcc45748f2fd9da971..e051691428a438134ef9ed928869fd06d32ab1de 100644
--- a/gas/testsuite/gas/arm/attr-march-all.d
+++ b/gas/testsuite/gas/arm/attr-march-all.d
@@ -8,7 +8,7 @@
 Attribute Section: aeabi
 File Attributes
   Tag_CPU_name: "all"
-  Tag_CPU_arch: v8
+  Tag_CPU_arch: v9
   Tag_CPU_arch_profile: Application
   Tag_ARM_ISA_use: Yes
   Tag_THUMB_ISA_use: Thumb-2
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 299f394b7aef4394cf2d34e5c42127f4d564a930..8213b90e981f168389d6318a1ac0be66d75f9633 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -111,8 +111,12 @@
 #define TAG_CPU_ARCH_V8R	15
 #define TAG_CPU_ARCH_V8M_BASE	16
 #define TAG_CPU_ARCH_V8M_MAIN	17
+#define TAG_CPU_ARCH_8_1A       18
+#define TAG_CPU_ARCH_8_2A       19
+#define TAG_CPU_ARCH_8_3A       20
 #define TAG_CPU_ARCH_V8_1M_MAIN 21
-#define MAX_TAG_CPU_ARCH	TAG_CPU_ARCH_V8_1M_MAIN
+#define TAG_CPU_ARCH_V9         22
+#define MAX_TAG_CPU_ARCH	TAG_CPU_ARCH_V9
 /* Pseudo-architecture to allow objects to be compatible with the subset of
    armv4t and armv6-m.  This value should never be stored in object files.  */
 #define TAG_CPU_ARCH_V4T_PLUS_V6_M (MAX_TAG_CPU_ARCH + 1)
diff --git a/include/opcode/arm.h b/include/opcode/arm.h
index 4a6044f6f68ddb317d870f8a4ffb700641ee1d24..cf72b90bd55a759b0ffd4b4e644a061625e0f376 100644
--- a/include/opcode/arm.h
+++ b/include/opcode/arm.h
@@ -94,6 +94,7 @@
 					   Authentication and Branch
 					   Target Identification
 					   Extension.  */
+#define ARM_EXT3_V9A	        0x00000002 /* Armv9-A.	               */
 
 /* Co-processor space extensions.  */
 #define ARM_CEXT_XSCALE	     0x00000001	/* Allow MIA etc.	 	   */
@@ -385,11 +386,16 @@
 #define ARM_ARCH_V8R	       ARM_FEATURE_CORE (ARM_AEXT_V8R, ARM_AEXT2_V8R)
 #define ARM_ARCH_V8_1M_MAIN    ARM_FEATURE_CORE (ARM_AEXT_V8_1M_MAIN,	   \
 						 ARM_AEXT2_V8_1M_MAIN)
+#define ARM_ARCH_V9A	       ARM_FEATURE_ALL(ARM_AEXT_V8A,	   \
+				      ARM_AEXT2_V8_5A | ARM_EXT2_CRC,	   \
+				      ARM_EXT3_V9A,	   \
+                      FPU_NEON_EXT_RDMA	| FPU_NEON_EXT_DOTPROD)
 
 /* Some useful combinations:  */
-#define ARM_ARCH_NONE	ARM_FEATURE_LOW (0, 0)
-#define FPU_NONE	ARM_FEATURE_LOW (0, 0)
-#define ARM_ANY		ARM_FEATURE (-1, -1 & ~ (ARM_EXT2_MVE | ARM_EXT2_MVE_FP), 0)	/* Any basic core.  */
+#define ARM_ARCH_NONE	ARM_FEATURE_ALL (0, 0, 0, 0)
+#define FPU_NONE	ARM_FEATURE_ALL (0, 0, 0, 0)
+#define ARM_ARCH_UNKNOWN	ARM_FEATURE_ALL (-1, -1 & ~(ARM_EXT2_MVE | ARM_EXT2_MVE_FP), -1, -1)	/* Machine type is unknown.  */
+#define ARM_ANY		ARM_FEATURE_ALL (-1, -1 & ~(ARM_EXT2_MVE | ARM_EXT2_MVE_FP), -1, 0)	/* Any basic core.  */
 #define FPU_ANY		ARM_FEATURE_COPROC (-1 & ~(ARM_CEXT_XSCALE | ARM_CEXT_IWMMXT | ARM_CEXT_IWMMXT2)) /* Any FPU.  */
 #define FPU_ANY_HARD	ARM_FEATURE_COPROC (FPU_FPA | FPU_VFP_HARD | FPU_MAVERICK)
 /* Extensions containing some Thumb-2 instructions.  If any is present, Thumb
@@ -429,8 +435,8 @@
 
 /* There are too many feature bits to fit in a single word, so use a
    structure.  For simplicity we put all core features in array CORE
-   and everything else in the other.  All the bits in element core[0]
-   have been occupied, so new feature should use bit in element core[1]
+   and everything else in the other.  All the bits in element core[0:1]
+   have been occupied, so new feature should use bit in element core[2]
    and use macro ARM_FEATURE to initialize the feature set variable.  */
 typedef struct
 {
@@ -494,10 +500,13 @@ typedef struct
    && (T1).core[1] == (T2).core[1]		\
    && (T1).core[2] == (T2).core[2])
 
-#define ARM_FEATURE_LOW(core, coproc) {{(core), 0}, (coproc)}
-#define ARM_FEATURE_CORE(core1, core2) {{(core1), (core2)}, 0}
-#define ARM_FEATURE_CORE_LOW(core) {{(core), 0}, 0}
-#define ARM_FEATURE_CORE_HIGH(core) {{0, (core)}, 0}
+#define ARM_FEATURE_LOW(core, coproc) {{(core), 0, 0}, (coproc)}
+#define ARM_FEATURE_CORE(core1, core2) {{(core1), (core2), 0}, 0}
+#define ARM_FEATURE_CORE_LOW(core) {{(core), 0, 0}, 0}
+#define ARM_FEATURE_CORE_HIGH(core) {{0, (core), 0}, 0}
 #define ARM_FEATURE_CORE_HIGH_HIGH(core) {{0, 0, (core)}, 0}
-#define ARM_FEATURE_COPROC(coproc) {{0, 0}, (coproc)}
-#define ARM_FEATURE(core1, core2, coproc) {{(core1), (core2)}, (coproc)}
+#define ARM_FEATURE_COPROC(coproc) {{0, 0, 0}, (coproc)}
+#define ARM_FEATURE(core1, core2, coproc) {{(core1), (core2), 0}, (coproc)}
+/* Below macro is used to set all fields in arm_feature_set struct.
+*/
+#define ARM_FEATURE_ALL(core1, core2, core3, coproc) {{(core1), (core2), (core3)}, (coproc)}
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 78efb815147df2c5dc30077ec9b89681e0d34a21..e6e2770bfc87de919b5b8cd91e92c0bc3c3c6914 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -12028,12 +12028,11 @@ select_arm_features (unsigned long mach,
       ARM_MERGE_FEATURE_SETS (arch_fset, arch_fset, mve_all);
       force_thumb = 1;
       break;
+    case bfd_mach_arm_9:         ARM_SET_FEATURES (ARM_ARCH_V9A); break;
       /* If the machine type is unknown allow all architecture types and all
 	 extensions, with the exception of MVE as that clashes with NEON.  */
     case bfd_mach_arm_unknown:
-      ARM_SET_FEATURES (ARM_FEATURE (-1,
-				     -1 & ~(ARM_EXT2_MVE | ARM_EXT2_MVE_FP),
-				     -1));
+      ARM_SET_FEATURES (ARM_ARCH_UNKNOWN);
       break;
     default:
       abort ();

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH][GAS] arm: add armv9-a architecture to -march
  2021-10-04 20:24 [PATCH][GAS] arm: add armv9-a architecture to -march Przemyslaw Wirkus
@ 2021-10-12  9:10 ` Przemyslaw Wirkus
  2021-10-29 11:48 ` Nick Clifton
  2021-11-15 11:17 ` Martin Liška
  2 siblings, 0 replies; 8+ messages in thread
From: Przemyslaw Wirkus @ 2021-10-12  9:10 UTC (permalink / raw)
  To: Binutils; +Cc: Richard Earnshaw, Marcus Shawcroft, nickc

Ping :)

> -----Original Message-----
> From: Przemyslaw Wirkus
> Sent: 04 October 2021 21:25
> To: Binutils <binutils@sourceware.org>
> Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; Marcus Shawcroft
> (Marcus.Shawcroft@arm.com) <Marcus.Shawcroft@arm.com>; Nick Clifton
> <nickc@redhat.com>
> Subject: [PATCH][GAS] arm: add armv9-a architecture to -march
> 
> Patch is adding `armv9-a` to -march in Arm GAS.
> 
> This patch also updates:
> 	+ New value of Tag_CPU_arch EABI attribute (22) is added, see [0].
> 	+ Updated missing from code Tag_CPU_arch EABI attributes for
> 	  "Arm v8.1-A", "Arm v8.2-A" and "Arm v8.3-A" entries, see [0].
> 	+ New test `armv9-a_arch.d` to demonstrate that (22) is recognised
> 	  by readelf.
> 	+ Commit [1] extends arm_feature_set.core array. A follow up
> change
> 	  is done to e.g., initialize (with 0s) or other values existing
> 	  ARM_FEATURE_x macros. New macro ARM_FEATURE_ALL is added
> set all
> 	  fields of arm_feature_set.core array.
> 	+ Various changes are made to align asserts with new V9 arch.
> 	+ Updated how we combine archs 'v4t_plus_v6_m' as this
> mechanism
> 	must handle new Armv9 as well.
> 
> 	[0] https://github.com/ARM-software/abi-
> aa/blob/main/addenda32/addenda32.rst#3352the-target-related-attributes
> 	[1] 2c6ccfcfdde1 (arm: Extend again arm_feature_set struct to
> provide
> 	    more bits).
> 
> Regression tested on `arm-none-eabi` cross Binutils and no issues.
> 
> OK for master?
> 
> bfd/
> 
> 2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
> 
> 	* archures.c: Define bfd_mach_arm_9.
> 	* bfd-in2.h (bfd_mach_arm_9): Define bfd_mach_arm_9.
> 	* cpu-arm.c: Add 'armv9-a' option to -march.
> 	* elf32-arm.c (using_thumb2_bl): Update assert check.
> 	(arch_has_arm_nop): Add TAG_CPU_ARCH_V9.
> 	(bfd_arm_get_mach_from_attributes): Add case for
> TAG_CPU_ARCH_V9.
> 	Update assert.
> 	(tag_cpu_arch_combine): Updated table.
> 	(tag_cpu_arch_combine): Updated table.
> 	(tag_cpu_arch_combine): Updated table.
> 	(v9): New table..
> 
> binutils/
> 
> 2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
> 
> 	* readelf.c (arm_attr_tag_CPU_arch): Update with
> 
> elfcpp/
> 
> 2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
> 
> 	* arm.h: Update TAG_CPU_ARCH_ enums with currect values.
> 
> gas/
> 
> 2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
> 
> 	* NEWS: Update docs.
> 	* config/tc-arm.c (get_aeabi_cpu_arch_from_fset): Return Armv9-a
> 	for -amarch=all.
> 	(aeabi_set_public_attributes): Update assert.
> 	* doc/c-arm.texi: Update docs.
> 	* testsuite/gas/arm/armv9-a_arch.d: New test.
> 	* testsuite/gas/arm/attr-march-all.d: Update test with v9.
> 
> include/
> 
> 2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
> 
> 	* elf/arm.h Update TAG_CPU_ARCH_ defines with currect values.
> 	* opcode/arm.h (ARM_EXT3_V9A): New macro.
> 	(ARM_ARCH_NONE): Updated with arm_feature_set.core size.
> 	(FPU_NONE): Updated.
> 	(ARM_ANY): Updated.
> 	(ARM_ARCH_UNKNOWN): New macro.
> 	(ARM_FEATURE_LOW): Updated.
> 	(ARM_FEATURE_CORE): Updated.
> 	(ARM_FEATURE_CORE_LOW): Updated.
> 	(ARM_FEATURE_CORE_HIGH): Updated.
> 	(ARM_FEATURE_COPROC): Updated.
> 	(ARM_FEATURE): Updated.
> 	(ARM_FEATURE_ALL): New macro.
> 
> opcodes/
> 
> 2021-09-21  Przemyslaw Wirkus  <przemyslaw.wirkus@arm.com>
> 
> 	* arm-dis.c (select_arm_features): Support bfd_mach_arm_9.
> 	Also Update bfd_mach_arm_unknown to use new macro
> ARM_ARCH_UNKNOWN.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][GAS] arm: add armv9-a architecture to -march
  2021-10-04 20:24 [PATCH][GAS] arm: add armv9-a architecture to -march Przemyslaw Wirkus
  2021-10-12  9:10 ` Przemyslaw Wirkus
@ 2021-10-29 11:48 ` Nick Clifton
  2021-11-01 10:56   ` Przemyslaw Wirkus
  2021-11-15 11:17 ` Martin Liška
  2 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2021-10-29 11:48 UTC (permalink / raw)
  To: Przemyslaw Wirkus, Binutils; +Cc: Richard Earnshaw, Marcus Shawcroft

Hi Przemyslaw,

> OK for master?

Approved - please apply.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][GAS] arm: add armv9-a architecture to -march
  2021-10-29 11:48 ` Nick Clifton
@ 2021-11-01 10:56   ` Przemyslaw Wirkus
  0 siblings, 0 replies; 8+ messages in thread
From: Przemyslaw Wirkus @ 2021-11-01 10:56 UTC (permalink / raw)
  To: nickc, Binutils; +Cc: Richard Earnshaw, Marcus Shawcroft

>> OK for master?

> Approved - please apply.

Thank you!

commit 3197e593d8a2a79a23dc9155d18d7aff6281da14

> Cheers
>    Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][GAS] arm: add armv9-a architecture to -march
  2021-10-04 20:24 [PATCH][GAS] arm: add armv9-a architecture to -march Przemyslaw Wirkus
  2021-10-12  9:10 ` Przemyslaw Wirkus
  2021-10-29 11:48 ` Nick Clifton
@ 2021-11-15 11:17 ` Martin Liška
  2021-11-15 11:19   ` Przemyslaw Wirkus
  2 siblings, 1 reply; 8+ messages in thread
From: Martin Liška @ 2021-11-15 11:17 UTC (permalink / raw)
  To: Przemyslaw Wirkus, Binutils; +Cc: Richard Earnshaw, Marcus Shawcroft

Hello.

A question: I'm building cross GCC compiler with the latest binutils master,
as I see:

Error: unknown architecture `armv9-a'

Where I configure binutils with --enable-targets=...,armv9l-suse-linux.
What am I doing wrong?

Can you please add a GAS test-case that 'armv9-a' is accepted for .arch directive?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH][GAS] arm: add armv9-a architecture to -march
  2021-11-15 11:17 ` Martin Liška
@ 2021-11-15 11:19   ` Przemyslaw Wirkus
  2021-11-15 20:40     ` Przemyslaw Wirkus
  0 siblings, 1 reply; 8+ messages in thread
From: Przemyslaw Wirkus @ 2021-11-15 11:19 UTC (permalink / raw)
  To: Martin Liška, Binutils; +Cc: Richard Earnshaw, Marcus Shawcroft

> -----Original Message-----
> From: Martin Liška <mliska@suse.cz>
> Sent: 15 November 2021 11:17
> To: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com>; Binutils
> <binutils@sourceware.org>
> Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; Marcus Shawcroft
> <Marcus.Shawcroft@arm.com>
> Subject: Re: [PATCH][GAS] arm: add armv9-a architecture to -march
> 
> Hello.
> 
> A question: I'm building cross GCC compiler with the latest binutils master, as
> I see:
> 
> Error: unknown architecture `armv9-a'
> 
> Where I configure binutils with --enable-targets=...,armv9l-suse-linux.
> What am I doing wrong?
> 
> Can you please add a GAS test-case that 'armv9-a' is accepted for .arch
> directive?

Of course. I will look into that asap.

Cheers!

> Thanks,
> Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH][GAS] arm: add armv9-a architecture to -march
  2021-11-15 11:19   ` Przemyslaw Wirkus
@ 2021-11-15 20:40     ` Przemyslaw Wirkus
  2021-11-16  8:08       ` Martin Liška
  0 siblings, 1 reply; 8+ messages in thread
From: Przemyslaw Wirkus @ 2021-11-15 20:40 UTC (permalink / raw)
  To: Martin Liška, Binutils; +Cc: Richard Earnshaw, Marcus Shawcroft



> -----Original Message-----
> From: Przemyslaw Wirkus
> Sent: 15 November 2021 11:20
> To: Martin Liška <mliska@suse.cz>; Binutils <binutils@sourceware.org>
> Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; Marcus Shawcroft
> <Marcus.Shawcroft@arm.com>
> Subject: RE: [PATCH][GAS] arm: add armv9-a architecture to -march
> 
> > -----Original Message-----
> > From: Martin Liška <mliska@suse.cz>
> > Sent: 15 November 2021 11:17
> > To: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com>; Binutils
> > <binutils@sourceware.org>
> > Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; Marcus Shawcroft
> > <Marcus.Shawcroft@arm.com>
> > Subject: Re: [PATCH][GAS] arm: add armv9-a architecture to -march
> >
> > Hello.
> >
> > A question: I'm building cross GCC compiler with the latest binutils
> > master, as I see:
> >
> > Error: unknown architecture `armv9-a'
> >
> > Where I configure binutils with --enable-targets=...,armv9l-suse-linux.
> > What am I doing wrong?

Please try with explicit --target flag:

$ cd $BUILD_DIR
$ $BINUTILS_SRC/configure --disable-nsl --prefix=$PREFIX  \
  --enable-targets=armv9l-suse-linux --target=armv9l-suse-linux

Works fine:

$ cat test.s
.arch armv9-a
    nop
    nop

$ ./bin/bin/armv9l-suse-linux-as test.s
$ ./bin/bin/armv9l-suse-linux-readelf -A a.out
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "9-A"
  Tag_CPU_arch: v9
  Tag_CPU_arch_profile: Application
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-2
  Tag_Advanced_SIMD_arch: NEON for ARMv8.1
  Tag_MPextension_use: Allowed
  Tag_Virtualization_use: TrustZone and Virtualization Extensions

> > Can you please add a GAS test-case that 'armv9-a' is accepted for
> > .arch directive?
> 
> Of course. I will look into that asap.
> 
> Cheers!
> 
> > Thanks,
> > Martin

Cheers!
Przemek


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH][GAS] arm: add armv9-a architecture to -march
  2021-11-15 20:40     ` Przemyslaw Wirkus
@ 2021-11-16  8:08       ` Martin Liška
  0 siblings, 0 replies; 8+ messages in thread
From: Martin Liška @ 2021-11-16  8:08 UTC (permalink / raw)
  To: Przemyslaw Wirkus, Binutils; +Cc: Richard Earnshaw, Marcus Shawcroft

On 11/15/21 21:40, Przemyslaw Wirkus wrote:
> 
> 
>> -----Original Message-----
>> From: Przemyslaw Wirkus
>> Sent: 15 November 2021 11:20
>> To: Martin Liška <mliska@suse.cz>; Binutils <binutils@sourceware.org>
>> Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; Marcus Shawcroft
>> <Marcus.Shawcroft@arm.com>
>> Subject: RE: [PATCH][GAS] arm: add armv9-a architecture to -march
>>
>>> -----Original Message-----
>>> From: Martin Liška <mliska@suse.cz>
>>> Sent: 15 November 2021 11:17
>>> To: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com>; Binutils
>>> <binutils@sourceware.org>
>>> Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>; Marcus Shawcroft
>>> <Marcus.Shawcroft@arm.com>
>>> Subject: Re: [PATCH][GAS] arm: add armv9-a architecture to -march
>>>
>>> Hello.
>>>
>>> A question: I'm building cross GCC compiler with the latest binutils
>>> master, as I see:
>>>
>>> Error: unknown architecture `armv9-a'
>>>
>>> Where I configure binutils with --enable-targets=...,armv9l-suse-linux.
>>> What am I doing wrong?
> 
> Please try with explicit --target flag:
> 
> $ cd $BUILD_DIR
> $ $BINUTILS_SRC/configure --disable-nsl --prefix=$PREFIX  \
>    --enable-targets=armv9l-suse-linux --target=armv9l-suse-linux

Hello.

Thank you, my bad. I forgot to rebuild cross binutils package that adds the support.

Cheers,
Martin

> 
> Works fine:
> 
> $ cat test.s
> .arch armv9-a
>      nop
>      nop
> 
> $ ./bin/bin/armv9l-suse-linux-as test.s
> $ ./bin/bin/armv9l-suse-linux-readelf -A a.out
> Attribute Section: aeabi
> File Attributes
>    Tag_CPU_name: "9-A"
>    Tag_CPU_arch: v9
>    Tag_CPU_arch_profile: Application
>    Tag_ARM_ISA_use: Yes
>    Tag_THUMB_ISA_use: Thumb-2
>    Tag_Advanced_SIMD_arch: NEON for ARMv8.1
>    Tag_MPextension_use: Allowed
>    Tag_Virtualization_use: TrustZone and Virtualization Extensions
> 
>>> Can you please add a GAS test-case that 'armv9-a' is accepted for
>>> .arch directive?
>>
>> Of course. I will look into that asap.
>>
>> Cheers!
>>
>>> Thanks,
>>> Martin
> 
> Cheers!
> Przemek
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-16  8:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04 20:24 [PATCH][GAS] arm: add armv9-a architecture to -march Przemyslaw Wirkus
2021-10-12  9:10 ` Przemyslaw Wirkus
2021-10-29 11:48 ` Nick Clifton
2021-11-01 10:56   ` Przemyslaw Wirkus
2021-11-15 11:17 ` Martin Liška
2021-11-15 11:19   ` Przemyslaw Wirkus
2021-11-15 20:40     ` Przemyslaw Wirkus
2021-11-16  8:08       ` Martin Liška

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).