This is the mail archive of the
mailing list for the GCC project.
Re: [I don't think it's off-topic at all] Linking speed for C++
- To: Joe Buck <jbuck at synopsys dot COM>
- Subject: Re: [I don't think it's off-topic at all] Linking speed for C++
- From: Richard Henderson <rth at redhat dot com>
- Date: Wed, 9 May 2001 11:09:12 -0700
- Cc: Andreas Jaeger <aj at suse dot de>, biswapesh dot chattopadhyay at bt dot com, gcc at gcc dot gnu dot org, bastian at suse dot com
- References: <firstname.lastname@example.org> <200105091620.JAA14244@toledo.synopsys.com>
On Wed, May 09, 2001 at 09:19:59AM -0700, Joe Buck wrote:
> If pic_vtable is specified, the function pointers in the virtual function
> table would be replaced by (pointer - vtable_address). This means that
> they would now be PIC.
No it doesn't. If pointer references a globaly visible symbol,
then the vtable is _still_ subject to dynamic relocation.
What you need is a pc-relative relocation to a PLT entry. Few
targets support this kind of relocation. Though x86 and Sparc
do, so it's not entirely without merit.
> register1 <- *(register0)
> register2 <- *(offset + register1) + register1
> call *register2
You'd wind up with
r1 = *r0
r2 = r1 + offset
r3 = *r2 + r2
with the relocations that are available on x86 and sparc.