x86 Assembly pushl/popl don't work with “Error: suffix or operands invalid”

后端 未结 5 741
逝去的感伤
逝去的感伤 2020-11-29 01:45

I\'m a newbie to assembly programming, working through Programming Ground Up on an Ubuntu x86_64 desktop with GNU assembler v2.20.1.

I\'ve been able to assemble/link

5条回答
  •  伪装坚强ぢ
    2020-11-29 02:27

    You may push any value without push command like that

    decq %rsp
    movb $0, (%rsp)
    

    push 1 byte on stack and pop after

    movb (%rsp), %al
    incq %rsp
    

    And any other size. As compilator don't generate any error and all will work good! To address may use rbp register instead of rsp. Now is allowed.

提交回复
热议问题