With this function:
mov 1069833(%rip),%rax # 0x2b5c1bf9ef90 <_fini+3250648>
add %fs:0x0,%rax
retq
How do I interpret the second instruction and find out what was added to RAX?
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 code:
is returning the address of a thread-local variable.
%fs:0x0is the address of the TCB (Thread Control Block), and1069833(%rip)is the offset from there to the variable, which is known since the variable resides either in the program or on some dynamic library loaded at program’s load time (libraries loaded at runtime viadlopen()need some different code).This is explained in great detail in Ulrich Drepper’s TLS document, specially §4.3 and §4.3.6.