public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] aarch64: Treat operand Rt_IN_SYS_ALIASES as register number (PR 31919)
@ 2024-06-25 15:27 Jens Remus
  0 siblings, 0 replies; only message in thread
From: Jens Remus @ 2024-06-25 15:27 UTC (permalink / raw)
  To: binutils-cvs

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

commit 64daf9abd9c805770727ade9c8197f5e07b28324
Author: Jens Remus <jremus@linux.ibm.com>
Date:   Tue Jun 25 17:25:55 2024 +0200

    aarch64: Treat operand Rt_IN_SYS_ALIASES as register number (PR 31919)
    
    The AArch64 instruction table (aarch64-tbl.h) defines the operand
    Rt_IN_SYS_ALIASES as register number. During assembly it is correctly
    encoded as register number (reg.regno) in parse_operands. During
    disassembly it is first correctly decoded as register number (reg.regno)
    in aarch64_ext_regno called by aarch64_extract_operand, but then
    erroneously treated as immediate value (imm.value) in
    aarch64_print_operand.
    
    This resolves the assembler test case "gas/aarch64/brbe-brb-inst" to
    erroneously fail on s390. On AArch64 - being little-endian - the struct
    aarch64_opnd_info union fields reg.regno and imm.value share their
    least-significant bits. On s390 - being big-endian - they do not.
    
    opcodes/
            PR binutils/31919
            * aarch64-opc.c: Treat operand Rt_IN_SYS_ALIASES as register
            number.
    
    Bug: https://sourceware.org/PR31919
    Fixes: 72476aca8f58 ("aarch64: add Branch Record Buffer extension instructions")
    Signed-off-by: Jens Remus <jremus@linux.ibm.com>

Diff:
---
 opcodes/aarch64-opc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index 72eea596cae..0b090557808 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -4029,7 +4029,7 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc,
 	{
 	  /* Avoid printing an invalid additional value for Rt in SYS aliases such as
 	     BRB, provide a helpful comment instead */
-	  snprintf (comment, comment_size, "unpredictable encoding (Rt!=31): #%" PRIi64, opnd->imm.value);
+	  snprintf (comment, comment_size, "unpredictable encoding (Rt!=31): #%u", opnd->reg.regno);
 	  break;
 	}
       /* Omit the operand, e.g. RET.  */

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

only message in thread, other threads:[~2024-06-25 15:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 15:27 [binutils-gdb] aarch64: Treat operand Rt_IN_SYS_ALIASES as register number (PR 31919) Jens Remus

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