This is the mail archive of the 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: Bad code for ia64 with function pointer

GP is the global pointer.  In SVR4-style position independent code (PIC),
all static data is referenced indirectly via the GP.  Inter-module function
calls also indirect through the GP.  The GP points to a table of addresses
which is relocated (initialized) by the run-time loader (  This table
is usually called the global offset table (GOT).  This allows the code to
be loaded at any address.  This also allows the code to be shared among
multiple processes, by giving each process its own separate GOT.  Depending
on the ABI, the GP can either be set in a function prologue by using some
pc-relative reference, or it can be set by the caller.  If the GP is set
by the caller, then that means we need a special mechanism for indirect calls.
On some machines, an indirect call goes through a trampoline that sets the GP
value.  On some machines, like IA-64, a function pointer is a 2 word descriptor
that holds both the function address and the GP value.  We load the GP value
from the descriptor before we call the function address.


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