Re: Global Offset Table question..

Brian Gerst (bgerst@didntduck.org)
Sat, 22 Sep 2001 18:01:39 -0400


Dave Airlie wrote:
>
> I've been trying to get dynamic loading on the Linux/VAX project going,
> and I've having trouble with the Global Offset Table and how it magically
> gets in to the ebx register on x86.. where is this done?
>
> I think I've looked at the kernel, gcc, binutils, ld.so 1.9, glibc 2.2.3
> and can't see exactly where this happens...
>
> Anyone care to enlighten my poor brain...
>
> Thanks,
> Dave.
>

I assume you are talking about position independant code? On the x86,
the only instructions that can use IP-relative addressing are branch
instructions. This asm fragment shows how it's done:

call 1f
1: popl %ebx
addl $(GOT - 1b), %ebx

If the Vax has better support for IP-relative addressing, this may be
easier. On recent x86 procesors, the above code will screw up the
call/return cache (branch prediction) and cause performance penalties.

--
					Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/