我反汇编了用C++编写的简单程序,并且有一个函数:
080486a8 <_GLOBAL__I_main>:
80486a8: 55 push %ebp
80486a9: 89 e5 mov %esp,%ebp
80486ab: 83 ec 18 sub $0x18,%esp
80486ae: c7 44 24 04 ff ff 00 movl $0xffff,0x4(%esp)
80486b5: 00
80486b6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80486bd: e8 a6 ff ff ff call 8048668 <_Z41__static_initialization_and_destruction_0ii>
80486c2: c9 leave
80486c3: c3 ret
80486c4: 90 nop
80486c5: 90 nop
80486c6: 90 nop
80486c7: 90 nop
80486c8: 90 nop
80486c9: 90 nop
80486ca: 90 nop
80486cb: 90 nop
80486cc: 90 nop
80486cd: 90 nop
80486ce: 90 nop
80486cf: 90 nop
Run Code Online (Sandbox Code Playgroud)
这个功能是什么?为什么RET指令后有那么多NOP操作?
正如netrom所提到的,__static_initialization_and_destruction_0(int, int)安排全局构造函数和析构函数被调用.
许多编译器nop在函数之后添加指令以启用增量重新链接.如果稍微更改函数并且它会增长,则链接器不必移动后面的所有函数.相反,增长会覆盖一些前任nop.
| 归档时间: |
|
| 查看次数: |
236 次 |
| 最近记录: |