-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confused by text at page 307 #36
Comments
Sorry to have missed this issue for a long time, let me make this a bit more clear.
For each GOT (unique per object) the dynamic linker crawls the libraries in a breadth-first-order. It is building the 'global lookup scope' this way. The first object containing the said variable will be its host. The GOT will be
You can check the said facts by declaring a variable in both executable file and a shared library. Then print its address and hang. Something like: int g = 10;
void f(void) {
printf("%p\n", &g);
} Executable: int g;
int main(void) {
g++;
f();
while (1);
return 0;
} Then compile it, link and launch in background. Use |
Thanks for your detailed explanation. |
I'm confused by the following text at page 307:
Is this really true? Lets modify
ex2-main.asm
like this:Here we are accessing
msg
directly without GOT and things seem to work fine (the string is printed twice).The text was updated successfully, but these errors were encountered: