[8/8] x86: drop (explicit) BFD64 dependency from disassembler

Message ID 4eed4c72-002f-268e-b5cd-0929bc57d6d2@suse.com
State Accepted
Headers
Series x86: do away with (ab)using setjmp/longjmp for error handling |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Jan Beulich April 4, 2023, 7:01 a.m. UTC
  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).
  

Patch

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