Skip to content

Commit

Permalink
Fix definition of reserved fields in the GOT
Browse files Browse the repository at this point in the history
Three instead of two fields are actually reserved at the start of the GOT.
Reflect that.  Also replace "word" by "doubleword" when referring to
8-byte fields in the GOT.
  • Loading branch information
aarnez committed Nov 6, 2023
1 parent 35c5977 commit 5d0f29b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lzsabi.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4828,19 +4828,20 @@ \subsection{Global Offset Table}

The format and interpretation of the Global Offset Table is processor
specific. For \ABINAME{} the symbol \texttt{\_GLOBAL\_OFFSET\_TABLE\_}
may be used to access the table. The symbol refers to the start of
the \texttt{.got} section. Two words in the GOT are reserved:
may be used to access the table. The symbol refers to the start of the
\texttt{.got} section. The first three \ifzseries double\fi words in the
GOT are reserved:
\begin{itemize}
\item The word at \texttt{\_GLOBAL\_OFFSET\_TABLE\_[0]} is set by the
linkage editor to hold the address of the dynamic structure,
referenced with the symbol \texttt{\_DYNAMIC}. This allows a
program, such as the dynamic linker, to find its own dynamic
structure without having yet processed its relocation entries. This
is especially important for the dynamic linker, because it must
initialize itself without relying on other programs to relocate its
memory image.
\item The word at \texttt{\_GLOBAL\_OFFSET\_TABLE\_[1]} is reserved
for future use.
\item The \ifzseries double\fi word at
\texttt{\_GLOBAL\_OFFSET\_TABLE\_[0]} is set by the linkage editor to
hold the address of the dynamic structure, referenced with the symbol
\texttt{\_DYNAMIC}. This allows a program, such as the dynamic linker,
to find its own dynamic structure without having yet processed its
relocation entries. This is especially important for the dynamic
linker, because it must initialize itself without relying on other
programs to relocate its memory image.
\item The \ifzseries double\fi words at
\texttt{\_GLOBAL\_OFFSET\_TABLE\_[1...2]} are reserved for system use.
\end{itemize}

The Global Offset Table resides in the ELF \texttt{.got} section.
Expand Down

0 comments on commit 5d0f29b

Please sign in to comment.