public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Cc: "H.J. Lu" <hjl.tools@gmail.com>, Alan Modra <amodra@gmail.com>
Subject: [PATCH 8/8] x86: drop (explicit) BFD64 dependency from disassembler
Date: Tue, 4 Apr 2023 09:01:31 +0200	[thread overview]
Message-ID: <4eed4c72-002f-268e-b5cd-0929bc57d6d2@suse.com> (raw)
In-Reply-To: <5dac45a8-cd5f-ee4d-52fc-7d283fc29ec4@suse.com>

x86: drop (explicit) BFD64 dependency from disassembler

get64() is unreachable when !BFD64 (due to a check relatively early in
print_insn()). Let's avoid the associated #ifdef-ary (or else we should
extend it to remove more dead code).

--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -12329,9 +12329,8 @@ OP_G (instr_info *ins, int bytemode, int
   return true;
 }
 
-#ifdef BFD64
 static bool
-get64 (instr_info *ins, bfd_vma *res)
+get64 (instr_info *ins, uint64_t *res)
 {
   unsigned int a;
   unsigned int b;
@@ -12346,17 +12345,9 @@ get64 (instr_info *ins, bfd_vma *res)
   b |= (*ins->codep++ & 0xff) << 8;
   b |= (*ins->codep++ & 0xff) << 16;
   b |= (*ins->codep++ & 0xffu) << 24;
-  *res = a + ((bfd_vma) b << 32);
+  *res = a + ((uint64_t) b << 32);
   return true;
 }
-#else
-static bool
-get64 (instr_info *ins ATTRIBUTE_UNUSED, bfd_vma *res ATTRIBUTE_UNUSED)
-{
-  abort ();
-  return false;
-}
-#endif
 
 static bool
 get32 (instr_info *ins, bfd_signed_vma *res)
@@ -12571,7 +12562,7 @@ OP_I (instr_info *ins, int bytemode, int
 static bool
 OP_I64 (instr_info *ins, int bytemode, int sizeflag)
 {
-  bfd_vma op;
+  uint64_t op;
 
   if (bytemode != v_mode || ins->address_mode != mode_64bit
       || !(ins->rex & REX_W))
@@ -12785,7 +12776,7 @@ OP_OFF (instr_info *ins, int bytemode, i
 static bool
 OP_OFF64 (instr_info *ins, int bytemode, int sizeflag)
 {
-  bfd_vma off;
+  uint64_t off;
 
   if (ins->address_mode != mode_64bit
       || (ins->prefixes & PREFIX_ADDR))


      parent reply	other threads:[~2023-04-04  7:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  6:56 [PATCH 0/8] x86: do away with (ab)using setjmp/longjmp for error handling Jan Beulich
2023-04-04  6:58 ` [PATCH 1/8] x86: move fetch error handling into a helper function Jan Beulich
2023-04-04  6:58 ` [PATCH 2/8] x86: change fetch error handling in top-level function Jan Beulich
2023-04-04  6:59 ` [PATCH 3/8] x86: change fetch error handling in ckprefix() Jan Beulich
2023-04-04  6:59 ` [PATCH 4/8] x86: change fetch error handling in get_valid_dis386() Jan Beulich
2023-04-04  7:00 ` [PATCH 5/8] x86: change fetch error handling when processing operands Jan Beulich
2023-04-04  7:00 ` [PATCH 6/8] x86: change fetch error handling for get<N>() Jan Beulich
2023-04-04  7:01 ` [PATCH 7/8] x86: drop use of setjmp() from disassembler Jan Beulich
2023-04-04  7:01 ` Jan Beulich [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4eed4c72-002f-268e-b5cd-0929bc57d6d2@suse.com \
    --to=jbeulich@suse.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).