我正在使用 ac 到 x86 编译器,实际上我正在生成一些代码行,但是当我尝试启动它时出现分段错误,我无法找出错误的来源。这是代码:
.file "test.c"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
subl $32, %esp
movl $2, %eax
movl %eax, -4(%ebp)
movl $3, %eax
movl %eax, -8(%ebp)
movl -4(%ebp), %eax
popl %ecx
addl %ecx, %eax
pushl %eax
movl -8(%ebp), %eax
movl %eax, -12(%ebp)
段错误似乎出现在第一条指令“pushl %ebp”