鱼C论坛

 找回密码
 立即注册
查看: 3829|回复: 2

c编译成asm后好多看不懂,请赐教

[复制链接]
发表于 2017-7-22 22:46:21 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.10.25019.0 

        TITLE        C:\Users\Administrator\Documents\Visual Studio 2017\Projects\1.cpp
        .686P
        .XMM
        include listing.inc
        .model        flat

INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES

CONST        SEGMENT
$SG5328        DB        'Hello World!', 0aH, 00H
CONST        ENDS
PUBLIC        ___local_stdio_printf_options
PUBLIC        __vfprintf_l
PUBLIC        ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ ; __vcrt_va_start_verify_argument_type<char const * const>
PUBLIC        _printf
PUBLIC        _main
PUBLIC        ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
EXTRN        ___acrt_iob_func:PROC
EXTRN        ___stdio_common_vfprintf:PROC
;        COMDAT ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA
_BSS        SEGMENT
?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA DQ 01H DUP (?) ; `__local_stdio_printf_options'::`2'::_OptionsStorage
_BSS        ENDS
; Function compile flags: /Odtp
_TEXT        SEGMENT
_main        PROC
; File c:\users\administrator\documents\visual studio 2017\projects\1.cpp
; Line 2
        push        ebp
        mov        ebp, esp
; Line 3
        push        OFFSET $SG5328
        call        _printf
        add        esp, 4
; Line 4
        xor        eax, eax
; Line 5
        pop        ebp
        ret        0
_main        ENDP
_TEXT        ENDS
; Function compile flags: /Odtp
;        COMDAT _printf
_TEXT        SEGMENT
__Result$ = -8                                                ; size = 4
__ArgList$ = -4                                                ; size = 4
__Format$ = 8                                                ; size = 4
_printf        PROC                                                ; COMDAT
; File c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\stdio.h
; Line 952
        push        ebp
        mov        ebp, esp
        sub        esp, 8
; Line 955
        call        ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ ; __vcrt_va_start_verify_argument_type<char const * const>
        lea        eax, DWORD PTR __Format$[ebp+4]
        mov        DWORD PTR __ArgList$[ebp], eax
; Line 956
        mov        ecx, DWORD PTR __ArgList$[ebp]
        push        ecx
        push        0
        mov        edx, DWORD PTR __Format$[ebp]
        push        edx
        push        1
        call        ___acrt_iob_func
        add        esp, 4
        push        eax
        call        __vfprintf_l
        add        esp, 16                                        ; 00000010H
        mov        DWORD PTR __Result$[ebp], eax
; Line 957
        mov        DWORD PTR __ArgList$[ebp], 0
; Line 958
        mov        eax, DWORD PTR __Result$[ebp]
; Line 959
        mov        esp, ebp
        pop        ebp
        ret        0
_printf        ENDP
_TEXT        ENDS
; Function compile flags: /Odtp
;        COMDAT ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ
_TEXT        SEGMENT
??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ PROC        ; __vcrt_va_start_verify_argument_type<char const * const>, COMDAT
; File d:\vs2017enterprise\vc\tools\msvc\14.10.25017\include\vadefs.h
; Line 144
        push        ebp
        mov        ebp, esp
; Line 146
        pop        ebp
        ret        0
??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ ENDP        ; __vcrt_va_start_verify_argument_type<char const * const>
_TEXT        ENDS
; Function compile flags: /Odtp
;        COMDAT __vfprintf_l
_TEXT        SEGMENT
__Stream$ = 8                                                ; size = 4
__Format$ = 12                                                ; size = 4
__Locale$ = 16                                                ; size = 4
__ArgList$ = 20                                                ; size = 4
__vfprintf_l PROC                                        ; COMDAT
; File c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\stdio.h
; Line 640
        push        ebp
        mov        ebp, esp
; Line 641
        mov        eax, DWORD PTR __ArgList$[ebp]
        push        eax
        mov        ecx, DWORD PTR __Locale$[ebp]
        push        ecx
        mov        edx, DWORD PTR __Format$[ebp]
        push        edx
        mov        eax, DWORD PTR __Stream$[ebp]
        push        eax
        call        ___local_stdio_printf_options
        mov        ecx, DWORD PTR [eax+4]
        push        ecx
        mov        edx, DWORD PTR [eax]
        push        edx
        call        ___stdio_common_vfprintf
        add        esp, 24                                        ; 00000018H
; Line 642
        pop        ebp
        ret        0
__vfprintf_l ENDP
_TEXT        ENDS
; Function compile flags: /Odtp
;        COMDAT ___local_stdio_printf_options
_TEXT        SEGMENT
___local_stdio_printf_options PROC                        ; COMDAT
; File c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\corecrt_stdio_config.h
; Line 85
        push        ebp
        mov        ebp, esp
; Line 87
        mov        eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
; Line 88
        pop        ebp
        ret        0
___local_stdio_printf_options ENDP
_TEXT        ENDS
END

这是典型的HelloWorld c语言程序,用cl编译成asm后,有几个地方没明白啥意思。
比如下面这一段,没有见过呀!请高手看看能给说一下吧!~感谢~
$SG5328        DB        'Hello World!', 0aH, 00H
CONST        ENDS
PUBLIC        ___local_stdio_printf_options
PUBLIC        __vfprintf_l
PUBLIC        ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ ; __vcrt_va_start_verify_argument_type<char const * const>
PUBLIC        _printf
PUBLIC        _main
PUBLIC        ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
EXTRN        ___acrt_iob_func:PROC
EXTRN        ___stdio_common_vfprintf:PROC
;        COMDAT ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2017-7-22 22:47:36 | 显示全部楼层
还有
  mov        eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage

又是什么意思呢?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-7-23 21:36:45 | 显示全部楼层
附上c语言程序:
#include <stdio.h>

int main(){
    printf("Hello World!\n");
}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-7-5 10:36

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表