devel/objfw: fix build on powerpc64*
Taking the address of _objc_taggedPointerClasses with
addis %r6, %r2, _objc_taggedPointerClasses@toc@ha addi %r6, %r6, _objc_taggedPointerClasses@toc@l
emits an R_PPC64_TOC16_LO relocation against the symbol itself, which
requires the symbol to be non-preemptible and reachable relative to the
TOC pointer. Neither holds for a global symbol in a shared library, so
linking libobjfwrt.so fails on FreeBSD/powerpc64le:
ld: error: relocation R_PPC64_TOC16_LO cannot be used against symbol
'_objc_taggedPointerClasses'; recompile with -fPIC
>>> defined in tagged-pointer.lib.o
>>> referenced by lookup-asm.lib.o:(objc_msg_lookup) in archive
lookup-asm/lookup-asm.lib.aThe "recompile with -fPIC" hint is misleading: every object is already
compiled with -fPIC, and the offending sequence is in hand-written
assembly, which -fPIC does not affect.
Load the address from the GOT instead, which is the position independent
way to take the address of a preemptible global:
addis %r6, %r2, _objc_taggedPointerClasses@got@ha ld %r6, _objc_taggedPointerClasses@got@l(%r6)
The neighbouring _objc_taggedPointerSecret access is deliberately left
unchanged. It uses @toc with a ld, which loads the variable's *value* --
what the following xor needs. The classes access instead needs the
array's *address* for the subsequent ldx, and only the address-forming
sequence is affected.