From: Ian Lance Taylor <ian@wasabisystems.com>
To: Brian Ryner <bryner@brianryner.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Using the PLT for vtables (or not)
Date: Fri, 05 Dec 2003 07:15:00 -0000 [thread overview]
Message-ID: <m3ad67vivk.fsf@gossamer.airs.com> (raw)
In-Reply-To: <3FD01B98.9000304@brianryner.com>
Brian Ryner <bryner@brianryner.com> writes:
> Ian Lance Taylor wrote:
> > action, you're going to get the address of the PLT. So if it is OK to
> > take that special action, then you might as well take it when you
> > initialize the vtable at program start-up time.
> >
>
> What sort of vtable initialization happens at startup time? The
> vtables currently reside in a read-only section of memory, don't they?
Yes, that's what I meant, although I expressed it in a confusing
manner. The initialization consists of loading the executable file
into memory.
> > The real question is whether it is OK to skip the PLT for vtable
> > entries. Normally it is desirable to use the PLT because it permits
> > the main program to override calls made from within a shared library.
> > A vtable may be an exception to this, but that is not immediately
> > obvious to me.
> >
>
> Well, consider that if I were to build up a struct or array of
> function pointers from a class's constructor, I would be getting the
> real function address, not a PLT stub. This seems like the same thing
> conceptually as a vtable, and yet it would not have the PLT overhead.
Hmmm, I think I made an incorrect assumption here. What target are
you talking about? The behaviour I see for a vtable on
i686-pc-linux-gnu is the same as building an array of function
pointers by hand. What actually happens depends upon whether you use
-fpic when compiling and whether you link the vtable into a shared
library.
What target are you using? Can you give a complete example of what
you are talking about?
Ian
next prev parent reply other threads:[~2003-12-05 7:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-05 2:09 Brian Ryner
2003-12-05 2:52 ` Ian Lance Taylor
2003-12-05 7:05 ` Brian Ryner
2003-12-05 7:15 ` Ian Lance Taylor [this message]
2003-12-05 8:52 ` Brian Ryner
2003-12-05 10:14 ` Jakub Jelinek
2003-12-05 9:41 ` Jakub Jelinek
2003-12-05 10:42 ` Brian Ryner
2003-12-05 11:44 ` Jakub Jelinek
2003-12-05 7:11 Michael Elizabeth Chastain
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=m3ad67vivk.fsf@gossamer.airs.com \
--to=ian@wasabisystems.com \
--cc=bryner@brianryner.com \
--cc=gcc@gcc.gnu.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 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).