[PATCH] opcodes/x86: fix minor missed styling case

Cui, Lili lili.cui@intel.com
Wed Jul 24 02:31:22 GMT 2024


> > I noticed that the x86 instruction:
> >
> >   sar    $0x1,%rsi
> >
> > would fail to style the '$0x1' as an immediate.  This commit fixes that case.
> >

I'm afraid it is not a bug, it is to distinguish between the two formats below.

sar    r/m8, 1
sar    r/m8, imm8

Lili.
> >  opcodes/i386-dis.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index
> > bc141f31770..d44fee33eb5 100644
> > --- a/opcodes/i386-dis.c
> > +++ b/opcodes/i386-dis.c
> > @@ -12414,11 +12414,8 @@ OP_I (instr_info *ins, int bytemode, int
> > sizeflag)
> >  	}
> >        break;
> >      case const_1_mode:
> > -      if (ins->intel_syntax)
> > -	oappend (ins, "1");
> > -      else
> > -	oappend (ins, "$1");
> 
> It seems fixed the issue when the immediate is not decimal format right?
> 
> Thx,
> Haochen
> 
> > -      return true;
> > +      op = 1;
> > +      break;
> >      default:
> >        oappend (ins, INTERNAL_DISASSEMBLER_ERROR);
> >        return true;
> >
> > base-commit: 40578beee8a593e3668852238fd8e9f53790f2c9
> > --
> > 2.25.4



More information about the Binutils mailing list