All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Souza <thehazard@gmail.com>
To: linux-c-programming@vger.kernel.org
Subject: library calls relocation
Date: Thu, 30 Dec 2004 12:25:28 -0200	[thread overview]
Message-ID: <e1e1d5f404123006255ad56324@mail.gmail.com> (raw)

anyone knows any docs about how library relocations works ?
for example, i have a library called

/usr/lib/mylib.so.0

that has a function called mylib_init(), and a program that was linked
to use it, like (gcc -o test test.c -lmylib). I know that when the
program is executed, the ld-linux is called to load the required
libraries (that I believe, are listed in some ELF section). The
question is, supposing that in my binary i have a call to
mylib_init(), so it looks something like in objdump -D

pushl (%eax)
call 0x484763ec <mylib_init>

and I know that there is a symbol table that tells that 0x484763ec is
mylib_init from mylib.so.0. The question is: if i increment the
library with other things, etc, and recompile it (maybe in another
machine), the size and addresses of library symbols will get changed.
But, if I copy the compiled library back to the original system, and
run the program, it still working. If the address of mylib_init in the
library has changed, why the 'static' address 0x484763ec used in the
binary still get pointing to the mylib_init in the changed library ?

thanks guys =)

             reply	other threads:[~2004-12-30 14:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-30 14:25 Daniel Souza [this message]
2004-12-31  4:17 ` library calls relocation Amit Dang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1e1d5f404123006255ad56324@mail.gmail.com \
    --to=thehazard@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.