public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ramana Radhakrishnan <ramana.radhakrishnan@codito.com>
To: Tushar <tusharpadlikar@yahoo.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Shared libraries: Avoiding lazy procedure linkage
Date: Tue, 16 Nov 2004 12:44:00 -0000	[thread overview]
Message-ID: <4199F5FC.4010409@codito.com> (raw)
In-Reply-To: <20041116122022.90552.qmail@web50505.mail.yahoo.com>

Tushar wrote:
> Hello,
> 
> I've used gcc 3.4.1 and gcc 2.95.3 (This is actually
> arm-linux-gcc)for creating shared libraries. There is
> a difference in the way these two tool chains generate
> libraries. 
> In case of 3.4.1 the generated code uses lazy
> proceprocedure linkage (uses .plt .got route ) in
> shared libraries. In case of 2.95.3..... it doesnt do
> this. The compilation/linking options remaining the
> same.


Whether you are using 2.95 or 3.4.1, dynamic linking would always 
require the use of the PLT and the GOT on ELF / GNU Linux systems.

Lazy dynamic linking has nothing to do with the versions you are using. 
Lazy dynamic linking is actually a job of the dynamic linker / loader 
(ld-linux.so.2 usually on linux systems) and is controlled by the 
environment variable LD_BIND_NOW or the linker option -z now. This can 
be passed to the linker using the -Wl option with gcc. Lazy dynamic 
linking controls whether resolution of function references need to be 
done at load time or lazily whenever the function is referenced.

>  
> My question is...if  its possible to avoid this lazy
> procedure linkage in case of 3.4.1 using some command
> line option. (which is seemingly default in 2.95.3)

You might like to read Chapters 8-10 in the book by John Levine on 
Linkers and Loaders where he explains how the PLT and the GOT work . You 
might also like to read Ulrich Dreppers paper on how shared libraries 
work at : http://people.redhat.com/drepper/dsohowto.pdf



cheers
Ramana

      reply	other threads:[~2004-11-16 12:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-16 12:20 Tushar
2004-11-16 12:44 ` Ramana Radhakrishnan [this message]

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=4199F5FC.4010409@codito.com \
    --to=ramana.radhakrishnan@codito.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=tusharpadlikar@yahoo.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).