I assemble the following with nasm version 0.99.06, on Linux V 4.0, and it
appears to get the incorrect opcode (i.e., missing the REX.W prefix).
NASM version 0.99.06 compiled on Nov 11 2007
file: bug_rax.asm
==============================================
CPU X64
section CODE
global _bug1
_bug1:
enter 16,0
cmp rax, 0
je .get_out
mov rax, 1
.get_out:
leave
ret ;; <------------------------ RETURN
nasm -f elf64 bug_rax.asm
ndisasm -e 448 -b 64 -k 23,265 bug_rax.o
ndisasm (output below):
=====================================================
00000000 C8100000 enter 0x10,0x0
00000004 3D00000000 cmp eax,0x0 <== comparing eax instead of rax ????
00000009 740A jz 0x15
0000000B 48B8010000000000 mov rax,0x1
-0000
00000015 C9 leave
00000016 C3 ret
00000017 skipping 0x109 bytes
I am pretty sure this is a bug,
Regards,
Gordon K. Wampler (Unitech Research)