This is the mail archive of the
mailing list for the GCC project.
Re: Dumb question...what's GOT?
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: Rick Mann <rmann at latencyzero dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 14 Nov 2007 18:14:19 +0000
- Subject: Re: Dumb question...what's GOT?
- References: <CADEF623-43A9-4F7A-A896-4AAD3E3B282E@latencyzero.com>
Rick Mann writes:
> Hi. I've seen a lot of GOT-related questions, and there are .got
> sections...what's GOT? It's kinda hard to search for in Google.
A global offset table provides information for address
calculation. Position-independent object files (executable and shared
object files) have this table in their data segment. When the system
creates the memory image for an object file, the table entries are
relocated to reflect the absolute virtual addresses as assigned for an
individual process. Because data segments are private for each
process, the table entries can change?unlike text segments, which
multiple processes share. Assembly language examples below show the
explicit notation needed for position-independent code.
name@ GOT ( %ebx )
This expression denotes an% e b x-relative reference to the global
offset table entry for the symbol name. The% e b x register contains
the absolute address of the global offset table, as explained below.
name@ GOTOFF ( %ebx )
This expression denotes an% e b x-relative reference to the symbol
name. Again,% e b x holds the global offset table address. Note
this expression references name, not the global offset table entry
System V Application Binary Interface - Intel386? Architecture
Processor Supplement, Fourth Edition