On many architectures gcc and clang will recognize _GLOBAL_OFFSET_TABLE_ - . and produce a relocation that can be processed without needing to know the value of _GLOBAL_OFFSET_TABLE_. For ARM gcc produces R_ARM_BASE_PREL but clang produces the more general R_ARM_REL32 to _GLOBAL_OFFSET_TABLE_. To evaluate this relocation correctly _GLOBAL_OFFSET_TABLE_ must be defined to be the base of the GOT (R_ARM_BASE_PREL evaluates to this value).
If/when llvm-mc is changed to recognize _GLOBAL_OFFSET_TABLE_ - . this change will not be necessary for new objects. However there may still be old objects and versions of clang so I think it is worth making the change in lld as well as fixing llvm-mc (pr33511).
This partially fixes pr31159, the R_ARM_REL32 relocation error messages disappear but there are a couple more relocation errors relating to R_ARM_GOTOFF32, I think that these are unrelated to _GLOBAL_OFFSET_TABLE_ though.
Doesn't this always succeed unless the -r option is given? It seems _GLOBAL_OFFSET_TABLE_ is added unconditionally, so find should return something non-null.