When accessing a global variable which is not defined in the translation-unit being compiled the compilers on ppc64 will generate a toc-entry for the global and a got-indirect access using that toc-entry (as if it were a .got entry)
For example the following C code
extern int aGlobal; int foo(void) { return aGlobal; }
would get translated to:
addis 3, 2, .LC0@toc@ha ld 3, .LC0@toc@l(3) lwa 3, 0(3) ... .section .toc,"aw",@progbits .LC0: .tc aGlobal[TC],aGlobal
Where .LC0@toc is the offset from the TOC base-pointer to the label .LC0, and .tc aGlobal[TC],aGlobal creates an entry in the .toc section to store the address of aGlobal.
The first 2 instructions build the address of the toc-entry and load the address of aGlobal into r3, while the following lwa instruction loads the value of the global into r3.
If the global being accessed is a non-preemptable definition and the offset from the TOC pointer to the definition can be materialized with 2 instructions then we can relax the first 2 instructions to add that offset to the TOC base pointer rather then loading the address out of the .toc.
The same.