动态链接和静态链接的指令点值 [英] instruction point value of dynamic linking and static linking
问题描述
通过使用 Intel 的 pin,我打印出具有动态链接和静态链接的程序的指令指针 (ip) 值.
By using Intel's pin, I printed out the instruction pointer (ip) values for a program with dynamic linking and static linking.
而且我发现他们的ip值大不相同,即使它们是同一个程序.
And I've found that their ip values are quite different, even though they are the same program.
具有静态链接的程序的第一个 ip 值显示为 0x400f50.
A program with static linking shows 0x400f50 for its very first ip value.
但是一个带有动态链接的程序的第一个 ip 值显示为 0x7f94f0762090
but a program with dynamic linking shows 0x7f94f0762090 for its first ip value
我不知道为什么他们有这么大的差距.
I am not sure why they have that quite a large gap.
如果有人能帮我找出原因,将不胜感激
It would be appreciated if anyone could help me find out the reason
推荐答案
我不知道为什么他们有这么大的差距.
I am not sure why they have that quite a large gap.
因为动态链接的程序不会在二进制中开始执行:在控制转移到 _start 之前,在动态链接器 (
在主可执行文件中.ld-linux
) 中执行前几千条指令
Because a dynamically linked program does not start executing in the binary: the first few thousands of instructions are executed in the dynamic linker (ld-linux
), before control is transferred to _start
in the main executable.
另见这个答案.
这篇关于动态链接和静态链接的指令点值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!