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

后端 未结 5 740
逝去的感伤
逝去的感伤 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:24

    I ran into this error working through the same book. I created the following shell script (att.sh):

    #!/bin/sh
    as --32 $1.s -o $1
    ld -melf_i386 $1.o -o $1
    ./$1
    echo $?
    

    Which I then made executable and ran (assuming an input file myfile.s):

    chmod +x ./att.sh
    ./att.sh myfile
    

提交回复
热议问题