Regarding GOT table in PIC code
Andrew Haley
aph@redhat.com
Mon Jan 9 11:17:00 GMT 2012
On 01/09/2012 10:06 AM, Chethan Palakshamurthy wrote:
> 1. Does the dynamic linker map the physical pages for .data segments
> such that GOT is at a fixed offset from code in logical address space?
> is this true?
Yes, it has to do this or it wouldn't be possible to find the GOT.
> 2. Aren't the variables themselves at a fixed offset from GOT (since
> GOT is part of data segment)? So, can't the code just access the data
> relative to PC with a single indirection?
No, because there may be more than one declaration of X: X may be
declared in more than one shared object file. So, it may be
necessary to fix up references to X to point outside a shared
object, even though it contains a definition of X.
Andrew.
More information about the Gcc-help
mailing list