Error: operand size mismatch for `movq'

后端 未结 2 1209
再見小時候
再見小時候 2021-01-19 10:48

I\'m trying to compile the following assembly...

movq $0x3534373536383235, 0x000000000055638f8
movq $0x55638f8, %rdi
retq

The first

2条回答
  •  耶瑟儿~
    2021-01-19 11:32

    If you look in the manual under the lemma MOV (which is, admittedly, a bit intimidating), you will find that there is no mov r/m64, imm64.

    There's a way to load a full 64bit constant into a register, and there's a way to load a sign-extended 32bit constant into a 64bit memory location, but there is no single instruction that takes a 64bit immediate and writes it to memory.

    So you have to do it in two steps, such as by using a temporary register or by writing two dwords straight to memory separately.

提交回复
热议问题