Does NASM change JNZ to JNE during build? What for?
I have a piece of code that uses JNZ. When I build and link the binary, I see that my JNZ is replacing the JNE. I understand that both are fundamentally the same. But why is NASM changing it?
Also, is there a config option to stop this change at build time?
I understand that both are fundamentally the same
JNE
and JNZ
have the same opcodes ( 0x75
for short hops and 0x0f 0x85
for close hops ), so the assembler will generate the same machine code for both of them.
When disassembled, the disassembler no longer knows which one was used in the source, and it must take one of them.
Also, is there a config option to stop this change at build time?
No, because this is not a real "replacement" - JNE
and JNZ
- just different mnemonics for the same opcodes.
JNZ
and JNE
have exactly the same coding (see Intel® 64 and IA-32 Architect 2A 3-419 Software Developer's Guide). Depending on what you are using in the assembler, the disassembler chooses one and uses the same notation in the parsed code.