什么是__i686.get_pc_thunk.bx?为什么我们需要这个电话? [英] What is __i686.get_pc_thunk.bx? Why do we need this call?

查看:166
本文介绍了什么是__i686.get_pc_thunk.bx?为什么我们需要这个电话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我分解我的小函数时,我碰巧看到了这个调用

When I disassemble my small function, I happened to see this call

call   0xf60d2f47 <__i686.get_pc_thunk.bx>.

我不知道为什么我的程序中需要此调用.任何解释都将有所帮助.

I have no clue why I need this call in my program. Any explanation would be helpful.

推荐答案

此调用在x86上与位置无关的代码中使用.它将代码的位置加载到%ebx寄存器中,从而允许访问全局对象(与代码具有固定的偏移量)作为与该寄存器的偏移量.

This call is used in position-independent code on x86. It loads the position of the code into the %ebx register, which allows global objects (which have a fixed offset from the code) to be accessed as an offset from that register.

与位置无关的代码是可以在不同地址处未经修改地加载和执行的代码.对于要链接到共享库中的代码而言,这一点很重要,因为它们可以映射到不同进程中的其他地址.

Position-independent code is code that can be loaded and executed, unmodified, at different addresses. It is important for code that will be linked into shared libraries, because these can be mapped at a different address in different processes.

请注意,在x86-64上,不需要 进行等效调用,因为该体系结构具有IP相对寻址模式(也就是说,它可以直接寻址内存位置,作为与内存位置的偏移量).当前说明).

Note that an equivalent call is not required on x86-64, because that architecture has IP-relative addressing modes (that is, it can directly address memory locations as an offset from the location of the current instruction).

这篇关于什么是__i686.get_pc_thunk.bx?为什么我们需要这个电话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆