鱼C论坛

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

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

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

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

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

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

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

  7. INCLUDELIB LIBCMT
  8. INCLUDELIB OLDNAMES

  9. CONST        SEGMENT
  10. $SG5328        DB        'Hello World!', 0aH, 00H
  11. CONST        ENDS
  12. PUBLIC        ___local_stdio_printf_options
  13. PUBLIC        __vfprintf_l
  14. PUBLIC        ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ ; __vcrt_va_start_verify_argument_type<char const * const>
  15. PUBLIC        _printf
  16. PUBLIC        _main
  17. PUBLIC        ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
  18. EXTRN        ___acrt_iob_func:PROC
  19. EXTRN        ___stdio_common_vfprintf:PROC
  20. ;        COMDAT ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA
  21. _BSS        SEGMENT
  22. ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA DQ 01H DUP (?) ; `__local_stdio_printf_options'::`2'::_OptionsStorage
  23. _BSS        ENDS
  24. ; Function compile flags: /Odtp
  25. _TEXT        SEGMENT
  26. _main        PROC
  27. ; File c:\users\administrator\documents\visual studio 2017\projects\1.cpp
  28. ; Line 2
  29.         push        ebp
  30.         mov        ebp, esp
  31. ; Line 3
  32.         push        OFFSET $SG5328
  33.         call        _printf
  34.         add        esp, 4
  35. ; Line 4
  36.         xor        eax, eax
  37. ; Line 5
  38.         pop        ebp
  39.         ret        0
  40. _main        ENDP
  41. _TEXT        ENDS
  42. ; Function compile flags: /Odtp
  43. ;        COMDAT _printf
  44. _TEXT        SEGMENT
  45. __Result$ = -8                                                ; size = 4
  46. __ArgList$ = -4                                                ; size = 4
  47. __Format$ = 8                                                ; size = 4
  48. _printf        PROC                                                ; COMDAT
  49. ; File c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\stdio.h
  50. ; Line 952
  51.         push        ebp
  52.         mov        ebp, esp
  53.         sub        esp, 8
  54. ; Line 955
  55.         call        ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ ; __vcrt_va_start_verify_argument_type<char const * const>
  56.         lea        eax, DWORD PTR __Format$[ebp+4]
  57.         mov        DWORD PTR __ArgList$[ebp], eax
  58. ; Line 956
  59.         mov        ecx, DWORD PTR __ArgList$[ebp]
  60.         push        ecx
  61.         push        0
  62.         mov        edx, DWORD PTR __Format$[ebp]
  63.         push        edx
  64.         push        1
  65.         call        ___acrt_iob_func
  66.         add        esp, 4
  67.         push        eax
  68.         call        __vfprintf_l
  69.         add        esp, 16                                        ; 00000010H
  70.         mov        DWORD PTR __Result$[ebp], eax
  71. ; Line 957
  72.         mov        DWORD PTR __ArgList$[ebp], 0
  73. ; Line 958
  74.         mov        eax, DWORD PTR __Result$[ebp]
  75. ; Line 959
  76.         mov        esp, ebp
  77.         pop        ebp
  78.         ret        0
  79. _printf        ENDP
  80. _TEXT        ENDS
  81. ; Function compile flags: /Odtp
  82. ;        COMDAT ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ
  83. _TEXT        SEGMENT
  84. ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ PROC        ; __vcrt_va_start_verify_argument_type<char const * const>, COMDAT
  85. ; File d:\vs2017enterprise\vc\tools\msvc\14.10.25017\include\vadefs.h
  86. ; Line 144
  87.         push        ebp
  88.         mov        ebp, esp
  89. ; Line 146
  90.         pop        ebp
  91.         ret        0
  92. ??$__vcrt_va_start_verify_argument_type@QBD@@YAXXZ ENDP        ; __vcrt_va_start_verify_argument_type<char const * const>
  93. _TEXT        ENDS
  94. ; Function compile flags: /Odtp
  95. ;        COMDAT __vfprintf_l
  96. _TEXT        SEGMENT
  97. __Stream$ = 8                                                ; size = 4
  98. __Format$ = 12                                                ; size = 4
  99. __Locale$ = 16                                                ; size = 4
  100. __ArgList$ = 20                                                ; size = 4
  101. __vfprintf_l PROC                                        ; COMDAT
  102. ; File c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\stdio.h
  103. ; Line 640
  104.         push        ebp
  105.         mov        ebp, esp
  106. ; Line 641
  107.         mov        eax, DWORD PTR __ArgList$[ebp]
  108.         push        eax
  109.         mov        ecx, DWORD PTR __Locale$[ebp]
  110.         push        ecx
  111.         mov        edx, DWORD PTR __Format$[ebp]
  112.         push        edx
  113.         mov        eax, DWORD PTR __Stream$[ebp]
  114.         push        eax
  115.         call        ___local_stdio_printf_options
  116.         mov        ecx, DWORD PTR [eax+4]
  117.         push        ecx
  118.         mov        edx, DWORD PTR [eax]
  119.         push        edx
  120.         call        ___stdio_common_vfprintf
  121.         add        esp, 24                                        ; 00000018H
  122. ; Line 642
  123.         pop        ebp
  124.         ret        0
  125. __vfprintf_l ENDP
  126. _TEXT        ENDS
  127. ; Function compile flags: /Odtp
  128. ;        COMDAT ___local_stdio_printf_options
  129. _TEXT        SEGMENT
  130. ___local_stdio_printf_options PROC                        ; COMDAT
  131. ; File c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\corecrt_stdio_config.h
  132. ; Line 85
  133.         push        ebp
  134.         mov        ebp, esp
  135. ; Line 87
  136.         mov        eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
  137. ; Line 88
  138.         pop        ebp
  139.         ret        0
  140. ___local_stdio_printf_options ENDP
  141. _TEXT        ENDS
  142. 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语言程序:
  1. #include <stdio.h>

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-20 13:29

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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