LEA EAX [EAX] 有什么意义?
LEA EAX, [EAX]
我在使用 Microsoft C 编译器编译的二进制文件中遇到了这条指令。它显然不能改变EAX的值。那么它为什么会在那里呢?
LEA EAX, [EAX]
I encountered this instruction in a binary compiled with the Microsoft C compiler. It clearly can't change the value of EAX. Then why is it there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个
NOP
。以下内容通常用作
NOP
。它们都做同样的事情,但会产生不同长度的机器代码。根据对齐要求选择其中之一:It is a
NOP
.The following are typcially used as
NOP
. They all do the same thing but they result in machine code of different length. Depending on the alignment requirement one of them is chosen:来自这篇文章:
所以这只是一种 NOP,出现在 jmp 指令的目标之前,以便对齐它们。
有趣的是,您可以根据此类指令的特征来识别编译器。
From this article:
So this is just a kind of NOP, appearing right before targets of jmp instructions in order to align them.
Interestingly, you can identify the compiler from the characteristic nature of such instructions.
事实上并没有改变EAX的值。据我了解,它的功能与以下内容相同:
您在优化代码还是未优化代码中看到它?
Indeed doesn't change the value of EAX. As far as I understand, it's identical in function to:
Did you see it in optimized code, or unoptimized code?