[英]Finding out type of assembly language generated by `gcc hello_world.c -S`
hello_world.c
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
運行gcc hello_world.c -S
以匯編語言生成hello_world.s
文件。
hello_world.s
.file "hello_world.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: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits
有什么方法可以找出生成哪種代碼的匯編語言(除了了解所有匯編語言的語法。)?
本人或其他不了解此內容的參考:
要獲得您的處理器體系結構,請運行以下命令 :
uname -p
默認情況下,它是目標代碼CPU的GNU匯編程序的AT&T語法。 有一些選項可以改變它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.