This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [committed, PATCH] PR binutis/18386: callw with 0x66 prefix incorrectly disassembled in 64-bit mode

>>> On 11.05.15 at 15:33, <> wrote:
> So AMD and Intel are different.  I think
> data16 callq rel32
> is better than
> callw rel16
> foobar

I don't think so - neither is going to result in proper disassembly of
following instructions when looked at from the opposite corner. I.e.
disassembling as instruction with 2-byte displacement when it was
written with a 4-byte one will yield rubbish for the two extra
bytes, while disassembling as instruction with 4-byte displacement
when it was written with a 2-byte one will wrongly consume the
next instruction's first two bytes. Without the user telling you (via
command line option or alike; in live gdb sessions it may also be
possible to simply default to the CPU being run on) and without a
relocation to infer the displacement size from, you just can't get it
right (and what was there before your patch was as good or as
bad as what is there now).

But of course a pretty clear conclusion here is - unless people
intentionally write vendor specific code, use of overrides with
these instructions would perhaps best be considered invalidating
the instructions altogether (i.e. an even more reasonable default
in the absence of knowing any better might be to disassemble
them just like other undefined ones).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]