[Nasm-bugs] [Bug 3392719] New: Disassembly does not always round-trip through nasm

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Sun Oct 11 21:01:53 PDT 2020


            Bug ID: 3392719
           Summary: Disassembly does not always round-trip through nasm
           Product: NASM
           Version: 2.15.xx
          Hardware: PC
                OS: Linux
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Disassembler
          Assignee: nobody at nasm.us
          Reporter: felix.von.s at posteo.de
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: From OS distribution

Just for one example:

$ printf '\x7e\x03' | ndisasm -
00000000  7E03              jng 0x5
$ echo 'jng 0x5' > a.asm; nasm a.asm -o a; ndisasm a
00000000  0F8E0100          jng near 0x5

Another one (this one round-trips with nasm -O0, though).

$ printf '\x68\x01\x00' | ndisasm -
00000000  680100            push word 0x1
$ echo 'push word 0x1' > a.asm; nasm a.asm -o a; ndisasm a
00000000  6A01              push byte +0x1

x86 has some redundant encodings for which NASM doesn’t seem to offer any
selection syntax (e.g. `and ax, imm16` may be `81E0xxxx` or `25xxxx`; NASM
consistently uses the latter), but for ones where there is one, I’d expect it
to be used: `push` should use `strict`, jump instructions should use `short` or
`near`, etc. (Perhaps some such syntax could be created: e.g. `and strict ax,
imm16` could refer to the `81E0xxxx` variant. But for other redundant
encodings, say `add ax, bx` there isn’t an obvious way to express the choice in
the syntax.)

This issue has been noticed by other people as well:

You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.

More information about the Nasm-bugs mailing list