This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using the PLT for vtables (or not)


On Fri, Dec 05, 2003 at 12:03:58AM -0800, Brian Ryner wrote:
> I am on i686-pc-linux-gnu.  I'm seeing some odd results in my testcase 
> which have me a little confused, maybe someone can explain what's going 
> on.  I have this class:
> 
> class A
> {
>   virtual void Foo();
> };
> 
> 
> and the definition of A::Foo() in a DSO.
> 
> If you unpack the attached testcase and build it, you'll get executables 
> called test1 and test2.  In test1, the vtable slot for A::Foo points 
> directly to A::Foo, not to a PLT stub.  In test2, it points to a PLT 
> stub.  The only difference is that in test2.cpp, I have an (unused) 
> function which calls A::Foo() directly, rather than through the vtable. 
>  This is with gcc 3.3.2, binutils version is 2.13.90.0.18-9 (rpm).

In the testcase you posted, the binary has a COPY relocation for the
virtual table, so what matters is how is the vtable in the shared library
resolved.  For your testcase CVS binutils will already do what you're
looking for.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]