zoukankan      html  css  js  c++  java
  • linux下C语言编译为汇编代码

    linux下将C语言编译为汇编代码,需用-S参数,如下代码

    void fun(int a,int b)
    {
    /*这个函数什么也不做*/
    }

    int main(void)
    {
    fun(
    100,200);
    return 0;
    }

    编译命令为:

    $ gcc -S s1.c

    编译后的结果为:

    1 .file "s1.c"
    2 .text
    3 .globl fun
    4 .type fun, @function
    5 fun:
    6 pushl %ebp
    7 movl %esp, %ebp
    8 popl %ebp
    9 ret
    10 .size fun, .-fun
    11 .globl main
    12 .type main, @function
    13 main:
    14 pushl %ebp
    15 movl %esp, %ebp
    16 subl $8, %esp
    17 movl $200, 4(%esp)
    18 movl $100, (%esp)
    19 call fun
    20 movl $0, %eax
    21 leave
    22 ret
    23 .size main, .-main
    24 .ident "GCC: (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5"
    25 .section .note.GNU-stack,"",@progbits

  • 相关阅读:
    JSTL和EL
    JSP
    Servlet基础知识
    JSON基础知识
    jQuery基础知识
    ajax基础知识
    索引实战
    反射
    设计模式
    JVM的异常处理
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2059151.html
Copyright © 2011-2022 走看看