小编Moh*_*ed 的帖子

C hello世界的汇编输出的每一行的含义是什么?

我在这上面运行了gcc -S:

int main()
{
printf ("Hello world!");
}
Run Code Online (Sandbox Code Playgroud)

我得到了这个汇编代码:

        .file   "test.c"
        .section        .rodata
.LC0:
        .string "Hello world!"
        .text
.globl main
        .type   main, @function
main:
        leal    4(%esp), %ecx
        andl    $-16, %esp
        pushl   -4(%ecx)
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ecx
        subl    $20, %esp
        movl    $.LC0, (%esp)
        call    printf
        addl    $20, %esp
        popl    %ecx
        popl    %ebp
        leal    -4(%ecx), %esp
        ret
        .size   main, .-main
        .ident  "GCC: (GNU) 4.3.0 20080428 (Red Hat 4.3.0-8)"
        .section        .note.GNU-stack,"",@progbits
Run Code Online (Sandbox Code Playgroud)

我很想知道这个输出.有人可以在理解这个输出时分享一些指示,或者如果有人可以针对这些行/行组中的每一行标记注释来解释它的作用,那将会很棒.

linux x86 assembly gcc

33
推荐指数
2
解决办法
2万
查看次数

标签 统计

assembly ×1

gcc ×1

linux ×1

x86 ×1