Dumb question...what's GOT?
Andrew Haley
aph-gcc@littlepinkcloud.COM
Thu Nov 15 05:58:00 GMT 2007
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
for name.
System V Application Binary Interface - Intel386? Architecture
Processor Supplement, Fourth Edition
http://www.caldera.com/developers/devspecs/abi386-4.pdf
More information about the Gcc-help
mailing list