This is the mail archive of the gcc-help@gcc.gnu.org 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: Dumb question...what's GOT?


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


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