I've separated this into a separate patch because it brings up a design question (which we might wish to solve as I've done here, or we might wish to solve in a completely different way).
Under PPC64 ELF v1 ABI, the symbols associated with each function name don't point directly to the code in the .text section (or similar), but rather to a function descriptor structure in a special data section named .opd. The elements in the .opd structure include a pointer to the actual code, and a the relevant TOC base value. Both of these are themselves set by relocations.
When we have a local call, we need the relevant relocation to refer directly to the target code, not to the function-descriptor in the .opd section. Only when we have a .plt stub do we care about the address of the .opd function descriptor itself.
We don't process relocations for the .opd section until after we process the code sections, and so when we're processing the relocation for a local call, we don't yet know the address of that call. We know the address of its function descriptor, but won't know the value in the descriptor until after we process relocations for the .opd section.
Here we store a vector of lambda function for each function descriptor, allowing us to go back and process the call relocations for local functions once the function-descriptor values are known.
Obviously still missing test cases, but feedback is certainly appreciated.
With this patch (and the others posted today), I can link, and run, a dynamically-compiled "hello world" application on big-Endian PPC64/Linux (ELF v1 ABI) using lld.
You may be able to eliminate the hash table by reading back previous relocatino results for R_PPC64_ADDR64 from Buf.