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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This call is used in position-independent code on x86. It loads the position of the code into the
%ebxregister, 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.
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).