git: 56ab61c888d5 - main - lang/ocaml: fix build on powerpc

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Sun, 04 Aug 2024 12:01:31 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=56ab61c888d5b384746e7ad639d5ae42ec9a6af9

commit 56ab61c888d5b384746e7ad639d5ae42ec9a6af9
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2024-08-02 10:17:33 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2024-08-04 12:00:52 +0000

    lang/ocaml: fix build on powerpc
    
    ld: error: relocation R_PPC_ADDR16_HA cannot be used against symbol 'caml_program'; recompile with -fPIC
    >>> defined in power_libasmrunpic.o
    >>> referenced by power_libasmrunpic.o:(caml_start_program)
    
    ld: error: relocation R_PPC_ADDR16_LO cannot be used against symbol 'caml_program'; recompile with -fPIC
    >>> defined in power_libasmrunpic.o
    >>> referenced by power_libasmrunpic.o:(caml_start_program)
    
    ld: error: relocation R_PPC_ADDR16_HA cannot be used against symbol 'caml_apply2'; recompile with -fPIC
    >>> defined in power_libasmrunpic.o
    >>> referenced by power_libasmrunpic.o:(caml_callback2_asm)
    
    ld: error: relocation R_PPC_ADDR16_LO cannot be used against symbol 'caml_apply2'; recompile with -fPIC
    >>> defined in power_libasmrunpic.o
    >>> referenced by power_libasmrunpic.o:(caml_callback2_asm)
    
    ld: error: relocation R_PPC_ADDR16_HA cannot be used against symbol 'caml_apply3'; recompile with -fPIC
    >>> defined in power_libasmrunpic.o
    >>> referenced by power_libasmrunpic.o:(caml_callback3_asm)
    
    ld: error: relocation R_PPC_ADDR16_LO cannot be used against symbol 'caml_apply3'; recompile with -fPIC
    >>> defined in power_libasmrunpic.o
    >>> referenced by power_libasmrunpic.o:(caml_callback3_asm)
    cc: error: linker command failed with exit code 1 (use -v to see invocation)
---
 lang/ocaml/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lang/ocaml/Makefile b/lang/ocaml/Makefile
index 8a00f54773f9..ccfcb3346fe5 100644
--- a/lang/ocaml/Makefile
+++ b/lang/ocaml/Makefile
@@ -55,6 +55,12 @@ DOCS_DISTFILES=			${DISTNAME:R}-refman-html.tar.gz:docs \
 				${DISTNAME:R}-refman.pdf:docs
 THREADS_CONFIGURE_ENABLE=	systhreads
 
+.include <bsd.port.options.mk>
+
+.if ${ARCH} == powerpc
+LLD_UNSAFE=	yes
+.endif
+
 post-install-DOCS-on:
 	${MKDIR} ${STAGEDIR}${DOCSDIR}
 	(cd ${WRKDIR} && ${COPYTREE_SHARE} htmlman ${STAGEDIR}${DOCSDIR})