A linker optimization is available on PowerPC for GOT indirect PCRelative loads.
The idea is that we can mark a usual GOT indirect load:
pld 3, vec@got@pcrel(0), 1 lwa 3, 4(3)
With a relocation to say that if we don't need to go through the GOT we can let the linker further optimize this and replace a load with a nop.
pld 3, vec@got@pcrel(0), 1 .Lpcrel1: .reloc .Lpcrel1-8,R_PPC64_PCREL_OPT,.-(.Lpcrel1-8) lwa 3, 4(3)
Which will eventually turn it into this by the linker (if we don't actually need to go through the GOT):
plwa 3, vec@got@pcrel+4(0), 1 nop
To create those relocations on the compiler side this patch adds an MCSymbol operand on the pld and the subsequent load or store that depends on it.
This symbol is then read in the MC layer and is used to match the two instructions together.
I think it would be clear if at the top level here we have something like this: