我是汇编编程的新手,在GNU汇编程序v2.20.1的Ubuntu x86_64桌面上使用Programming Ground Up.
我已经能够组装/链接执行我的代码,直到我使用pushl/popl指令来操作堆栈.以下代码无法汇编:
.section .data # empty
.section .text
.globl _start
_start:
pushl $1 # push the value 1 onto the stack
popl %eax # pop 1 off the stack and into the %eax register
int $0x80 # exit the program with exit code '1'
Run Code Online (Sandbox Code Playgroud)
使用"as test.s -o test.o",这些错误出现在终端上并且未创建test.o:
test.s: Assembler messages:
test.s:9: Error: suffix or operands invalid for 'push'
test.s:10: Error: suffix or operands invalid for 'popl'
Run Code Online (Sandbox Code Playgroud)
我检查了文档,我用于pushl和popl的操作数是有效的.这不是一个调试问题 - 所以我的代码出了什么问题?或者是我的汇编程序?