Date: Mon, 03 Aug 2026 15:21:49 +0000 From: Piotr Kubaj <pkubaj@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: 60252f383052 - main - devel/objfw: fix build on powerpc64* Message-ID: <6a70b20d.3b6d7.25391224@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=60252f38305257cf400dd94d6138b1ab4f955ed0 commit 60252f38305257cf400dd94d6138b1ab4f955ed0 Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2026-08-02 21:12:27 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2026-08-03 15:21:22 +0000 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.a The "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. --- .../patch-src_runtime_lookup-asm_lookup-asm-powerpc64-elf.S | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/devel/objfw/files/patch-src_runtime_lookup-asm_lookup-asm-powerpc64-elf.S b/devel/objfw/files/patch-src_runtime_lookup-asm_lookup-asm-powerpc64-elf.S new file mode 100644 index 000000000000..cc7859a92dff --- /dev/null +++ b/devel/objfw/files/patch-src_runtime_lookup-asm_lookup-asm-powerpc64-elf.S @@ -0,0 +1,13 @@ +--- src/runtime/lookup-asm/lookup-asm-powerpc64-elf.S.orig 2026-08-02 17:00:57 UTC ++++ src/runtime/lookup-asm/lookup-asm-powerpc64-elf.S +@@ -93,8 +93,8 @@ + xor %r5, %r3, %r5 + rlwinm %r5, %r5, 2, 0x38 + +- addis %r6, %r2, _objc_taggedPointerClasses@toc@ha +- addi %r6, %r6, _objc_taggedPointerClasses@toc@l ++ addis %r6, %r2, _objc_taggedPointerClasses@got@ha ++ ld %r6, _objc_taggedPointerClasses@got@l(%r6) + ldx %r5, %r6, %r5 + ld %r5, 64(%r5) +home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a70b20d.3b6d7.25391224>
