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]

Re: [I don't think it's off-topic at all] Linking speed for C++


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
	call *r3

with the relocations that are available on x86 and sparc.



r~


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