For most Targets the _GLOBAL_OFFSET_TABLE_ symbol is expected to be at the start of the .got.plt section so that _GLOBAL_OFFSET_TABLE_[0] = reserved value that is by convention the address of the dynamic section. Previously we had defined _GLOBAL_OFFSET_TABLE_ as either the start or end of the .got section with the intention that the .got.plt section would follow the .got. However this does not always hold with the current default section ordering so _GLOBAL_OFFSET_TABLE_[0] may not be consistent with the reserved first entry of the .got.plt.
In the patch, for X86, X86_64, Mips, Arm and AArch64 I've altered the location of the _GLOBAL_OFFSET_TABLE_ to be the start of the .got.plt section. For Power I've kept it as the ABI defined .got + 0x8000. For all except AArch64 this is consistent with Gold and BFD. They have chosen to use the start of the .got section for _GLOBAL_OFFSET_TABLE_, but I don't know of any software that depends on this, for example glibc/dl-machine.h reserves the same number of entries in the .got.plt as other targets and never directly accesses .got.plt[0] to use it for some other purpose.
Majority of the changes are to the tests as we now have to generate a .got.plt section if the _GLOBAL_OFFSET_TABLE_ symbol is defined rather than the .got.
fixes PR36555 (https://bugs.llvm.org/show_bug.cgi?id=36555)
Fixes PR36555.
On MIPS _GLOBAL_OFFSET_TABLE_ should point to the start of the .got section. I do not know any real test case uses this fact, but all GNU tools generates code which follow this rule.