2
我是很新的程序集,所以如果我問一個壞問題,請原諒我。我在Linux機器上使用GCC編譯器來運行我的代碼。所以我有一個簡單的Hello World的C代碼完美的作品,然後我用這個命令把它變成組件:X86 IA32程序集,壞註冊名稱
gcc -S hello.s
當我使用這個命令來運行它,我得到了一些不好的註冊名稱錯誤:
gcc -m32 hello.s -o hello
錯誤消息我得到的是:
hello.s:11: Error: bad register name '%rbp'
hello.s:14: Error: bad register name '%rsp'
hello.s:19: Error: bad register name '%rbp'
C代碼:
#include <stdio.h>
int main(void)
{
printf("hello, world\n");
return 0;
}
大會:
.file "hello.c"
.section .rodata
.LC0:
.string "hello, world"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $.LC0, %edi
call puts
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 4.7.2-5) 4.7.2"
.section .note.GNU-stack,"",@progbits
道歉的麻煩,很多預先感謝任何反饋。
我明白了!非常感謝您抽出時間回答我的問題。 – Yozuru