public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Fix ARM and AArch64 assembler tests to work in a multi-arch environment.
@ 2022-11-21 16:45 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2022-11-21 16:45 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1a7e622b82fa621ab505dd911bc30c1efcb4a9b0

commit 1a7e622b82fa621ab505dd911bc30c1efcb4a9b0
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Nov 21 16:44:02 2022 +0000

    Fix ARM and AArch64 assembler tests to work in a multi-arch environment.
    
            PR 29764
    gas     * testsuite/gas/arm/cpu-cortex-a76ae.d: Add arm prefix to the -m
            option passed to objdump.
            * testsuite/gas/arm/cpu-cortex-a77.d: Likewise.
            * testsuite/gas/aarch64/cpu-cortex-a76ae.d: Add aarch64 prefix to
            the -m option passed to objdump.
            * testsuite/gas/aarch64/cpu-cortex-a77.d: Likewise.
    
    bfd     * cpu-arm.c (scan): Accept machine names prefixed with "arm:".
            * cpu-aarch64.c (scan): Accept machine names prefixed with "aarch64:".
    
    bin     * doc/binutils.texi (objdump): Note that the -m option supports
            the <architecture>:<machine> syntax.

Diff:
---
 bfd/ChangeLog                                |  6 ++++++
 bfd/cpu-aarch64.c                            |  9 +++++++++
 bfd/cpu-arm.c                                |  9 +++++++++
 binutils/ChangeLog                           |  6 ++++++
 binutils/doc/binutils.texi                   |  6 ++++++
 gas/ChangeLog                                | 10 ++++++++++
 gas/testsuite/gas/aarch64/cpu-cortex-a76ae.d |  2 +-
 gas/testsuite/gas/aarch64/cpu-cortex-a77.d   |  2 +-
 gas/testsuite/gas/arm/cpu-cortex-a76ae.d     |  2 +-
 gas/testsuite/gas/arm/cpu-cortex-a77.d       |  2 +-
 10 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 06501775453..24aa783e1a7 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2022-11-21  Nick Clifton  <nickc@redhat.com>
+
+	PR 29764
+	* cpu-arm.c (scan): Accept machine names prefixed with "arm:".
+	* cpu-aarch64.c (scan): Accept machine names prefixed with "aarch64:".
+
 2022-10-19  Nick Clifton  <nickc@redhat.com>
 
 	PR 29699
diff --git a/bfd/cpu-aarch64.c b/bfd/cpu-aarch64.c
index eb88d0ef861..d51f2e3bde3 100644
--- a/bfd/cpu-aarch64.c
+++ b/bfd/cpu-aarch64.c
@@ -85,6 +85,15 @@ scan (const struct bfd_arch_info *info, const char *string)
   if (strcasecmp (string, info->printable_name) == 0)
     return true;
 
+  /* If there is a prefix of "aarch64:" then skip it.  */
+  const char * colon;
+  if ((colon = strchr (string, ':')) != NULL)
+    {
+      if (strncasecmp (string, "aarch64", colon - string) != 0)
+	return false;
+      string = colon + 1;
+    }
+
   /* Next check for a processor name instead of an Architecture name.  */
   for (i = sizeof (processors) / sizeof (processors[0]); i--;)
     {
diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c
index 853a118d4d4..6d77e1222dd 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -210,6 +210,15 @@ scan (const struct bfd_arch_info *info, const char *string)
   if (strcasecmp (string, info->printable_name) == 0)
     return true;
 
+  /* If there is a prefix of "arm:" then skip it.  */
+  const char * colon;
+  if ((colon = strchr (string, ':')) != NULL)
+    {
+      if (strncasecmp (string, "arm", colon - string) != 0)
+	return false;
+      string = colon + 1;
+    }
+
   /* Next check for a processor name instead of an Architecture name.  */
   for (i = sizeof (processors) / sizeof (processors[0]); i--;)
     {
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b6bb667d027..dfa5f1f22c8 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2022-11-21  Nick Clifton  <nickc@redhat.com>
+
+	PR 29764
+	* doc/binutils.texi (objdump): Note that the -m option supports
+	the <architecture>:<machine> syntax.
+
 2022-11-04  Nick Clifton  <nickc@redhat.com>
 
 	* README-how-to-make-a-release: Add instructions for uploading the
diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi
index 483b72f443e..6024301562d 100644
--- a/binutils/doc/binutils.texi
+++ b/binutils/doc/binutils.texi
@@ -2526,6 +2526,12 @@ can be useful when disassembling object files which do not describe
 architecture information, such as S-records.  You can list the available
 architectures with the @option{-i} option.
 
+For most architectures it is possible to supply an architecture
+name and a machine name, separated by a colon.  For example
+@samp{foo:bar} would refer to the @samp{bar} machine type in the
+@samp{foo} architecture.  This can be helpful if objdump has been
+configured to support multiple architectures.
+
 If the target is an ARM architecture then this switch has an
 additional effect.  It restricts the disassembly to only those
 instructions supported by the architecture specified by @var{machine}.
diff --git a/gas/ChangeLog b/gas/ChangeLog
index a299d024d95..74dbaa00c0c 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2022-11-21  Nick Clifton  <nickc@redhat.com>
+
+	PR 29764
+	* testsuite/gas/arm/cpu-cortex-a76ae.d: Add arm prefix to the -m
+	option passed to objdump.
+	* testsuite/gas/arm/cpu-cortex-a77.d: Likewise.
+	* testsuite/gas/aarch64/cpu-cortex-a76ae.d: Add aarch64 prefix to
+	the -m option passed to objdump.
+	* testsuite/gas/aarch64/cpu-cortex-a77.d: Likewise.
+
 2022-10-31  Nick Clifton  <nickc@redhat.com>
 
 	* testsuite/gas/rx/mvtacgu.d: Update expected disassembly.
diff --git a/gas/testsuite/gas/aarch64/cpu-cortex-a76ae.d b/gas/testsuite/gas/aarch64/cpu-cortex-a76ae.d
index 7f7cf2952c6..5870e307bf4 100644
--- a/gas/testsuite/gas/aarch64/cpu-cortex-a76ae.d
+++ b/gas/testsuite/gas/aarch64/cpu-cortex-a76ae.d
@@ -1,6 +1,6 @@
 # name: Assemble and dump for cortex-a76ae CPU
 # source: nop-asm.s
 # as: -mcpu=cortex-a76ae
-# objdump: -d -mcortex-a76ae
+# objdump: -d -maarch64:cortex-a76ae
 
 #...
diff --git a/gas/testsuite/gas/aarch64/cpu-cortex-a77.d b/gas/testsuite/gas/aarch64/cpu-cortex-a77.d
index caff73fe076..4a4af8fe3be 100644
--- a/gas/testsuite/gas/aarch64/cpu-cortex-a77.d
+++ b/gas/testsuite/gas/aarch64/cpu-cortex-a77.d
@@ -1,6 +1,6 @@
 # name: Assemble and dump for cortex-a77 CPU
 # source: nop-asm.s
 # as: -mcpu=cortex-a77
-# objdump: -d -mcortex-a77
+# objdump: -d -maarch64:cortex-a77
 
 #...
diff --git a/gas/testsuite/gas/arm/cpu-cortex-a76ae.d b/gas/testsuite/gas/arm/cpu-cortex-a76ae.d
index 7f7cf2952c6..b3cb849e5f3 100644
--- a/gas/testsuite/gas/arm/cpu-cortex-a76ae.d
+++ b/gas/testsuite/gas/arm/cpu-cortex-a76ae.d
@@ -1,6 +1,6 @@
 # name: Assemble and dump for cortex-a76ae CPU
 # source: nop-asm.s
 # as: -mcpu=cortex-a76ae
-# objdump: -d -mcortex-a76ae
+# objdump: -d -marm:cortex-a76ae
 
 #...
diff --git a/gas/testsuite/gas/arm/cpu-cortex-a77.d b/gas/testsuite/gas/arm/cpu-cortex-a77.d
index caff73fe076..090edcc6d0d 100644
--- a/gas/testsuite/gas/arm/cpu-cortex-a77.d
+++ b/gas/testsuite/gas/arm/cpu-cortex-a77.d
@@ -1,6 +1,6 @@
 # name: Assemble and dump for cortex-a77 CPU
 # source: nop-asm.s
 # as: -mcpu=cortex-a77
-# objdump: -d -mcortex-a77
+# objdump: -d -marm:cortex-a77
 
 #...

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-21 16:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 16:45 [binutils-gdb] Fix ARM and AArch64 assembler tests to work in a multi-arch environment Nick Clifton

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).