gcc 生成汇编代码

来源:互联网 发布:免费mysql数据库服务器 编辑:程序博客网 时间:2024/05/21 13:51

1. 编译

gcc -S hello.c

生成hello.s文件


2. 查看hello.s 文件


cat hello.s

        .file   "hello.c"        .section        .rodata.LC0:        .string "Hello,World!"        .text        .globl  main        .type   main, @functionmain:.LFB0:        .cfi_startproc        pushl   %ebp        .cfi_def_cfa_offset 8        .cfi_offset 5, -8        movl    %esp, %ebp        .cfi_def_cfa_register 5        andl    $-16, %esp        subl    $16, %esp        movl    $.LC0, (%esp)        call    puts        leave        .cfi_restore 5        .cfi_def_cfa 4, 4        ret        .cfi_endproc.LFE0:        .size   main, .-main        .ident  "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4"        .section        .note.GNU-stack,"",@progbits

0 0
原创粉丝点击