From owner-svn-ports-all@freebsd.org Mon Dec 16 12:56:08 2019 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E4CE1E3759; Mon, 16 Dec 2019 12:56:08 +0000 (UTC) (envelope-from pkubaj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47c1VJ0R09z3HWg; Mon, 16 Dec 2019 12:56:08 +0000 (UTC) (envelope-from pkubaj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0599A258FE; Mon, 16 Dec 2019 12:56:08 +0000 (UTC) (envelope-from pkubaj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBGCu7ES088203; Mon, 16 Dec 2019 12:56:07 GMT (envelope-from pkubaj@FreeBSD.org) Received: (from pkubaj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBGCu6Jk088198; Mon, 16 Dec 2019 12:56:06 GMT (envelope-from pkubaj@FreeBSD.org) Message-Id: <201912161256.xBGCu6Jk088198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkubaj set sender to pkubaj@FreeBSD.org using -f From: Piotr Kubaj Date: Mon, 16 Dec 2019 12:56:06 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r520254 - in head/lang/ocaml: . files X-SVN-Group: ports-head X-SVN-Commit-Author: pkubaj X-SVN-Commit-Paths: in head/lang/ocaml: . files X-SVN-Commit-Revision: 520254 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2019 12:56:08 -0000 Author: pkubaj Date: Mon Dec 16 12:56:06 2019 New Revision: 520254 URL: https://svnweb.freebsd.org/changeset/ports/520254 Log: lang/ocaml: fix build on powerpc64 elfv2 LLVM miscompiles ocaml on powerpc64 elfv2: ld: error: bytecomp/printlambda.ml:23:(.text+0x16): relocation R_PPC64_TOC16_DS out of range: 73024 is not in [-32768, 32767] Use GCC instead on powerpc64. Add a conditional patch enabled only on powerpc64 elfv2 to use elfv2 abi instead of elfv1. Add a bunch of other patches to correctly check for abi instead of relying on endianness. PR: 242389 Approved by: michipili@gmail.com (maintainer) Added: head/lang/ocaml/files/extra-patch-asmcomp_power_arch.ml (contents, props changed) head/lang/ocaml/files/patch-asmrun_power.S (contents, props changed) head/lang/ocaml/files/patch-byterun_caml_stack.h (contents, props changed) head/lang/ocaml/files/patch-testsuite_tests_asmcomp_power.S (contents, props changed) Modified: head/lang/ocaml/Makefile Modified: head/lang/ocaml/Makefile ============================================================================== --- head/lang/ocaml/Makefile Mon Dec 16 12:50:58 2019 (r520253) +++ head/lang/ocaml/Makefile Mon Dec 16 12:56:06 2019 (r520254) @@ -101,6 +101,11 @@ PLIST_SUB+= PROF="@comment " PLIST_SUB+= PROF="" .endif +.if defined(PPC_ABI) && ${PPC_ABI} == ELFv2 +EXTRA_PATCHES= ${PATCHDIR}/extra-patch-asmcomp_power_arch.ml +USE_GCC= yes +.endif + post-extract: .if ${PORT_OPTIONS:MDOCS} @if ! (cd ${WRKDIR} && \ Added: head/lang/ocaml/files/extra-patch-asmcomp_power_arch.ml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/ocaml/files/extra-patch-asmcomp_power_arch.ml Mon Dec 16 12:56:06 2019 (r520254) @@ -0,0 +1,11 @@ +--- asmcomp/power/arch.ml.orig 2019-12-02 10:44:34 UTC ++++ asmcomp/power/arch.ml +@@ -28,7 +28,7 @@ type abi = ELF32 | ELF64v1 | ELF64v2 + let abi = + match Config.model with + | "ppc" -> ELF32 +- | "ppc64" -> ELF64v1 ++ | "ppc64" -> ELF64v2 + | "ppc64le" -> ELF64v2 + | _ -> assert false + Added: head/lang/ocaml/files/patch-asmrun_power.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/ocaml/files/patch-asmrun_power.S Mon Dec 16 12:56:06 2019 (r520254) @@ -0,0 +1,99 @@ +--- asmrun/power.S.orig 2019-12-02 12:34:04 UTC ++++ asmrun/power.S +@@ -13,7 +13,7 @@ + /* */ + /**************************************************************************/ + +-#if defined(MODEL_ppc64le) ++#if _CALL_ELF == 2 + .abiversion 2 + #endif + +@@ -42,7 +42,7 @@ + #define CALLBACK_LINK_SIZE 16 + #define CALLBACK_LINK_OFFSET 0 + #endif +-#if defined(MODEL_ppc64) ++#if _CALL_ELF == 1 + #define RESERVED_STACK 48 + #define PARAM_SAVE_AREA (8*8) + #define LR_SAVE 16 +@@ -54,7 +54,7 @@ + #define CALLBACK_LINK_SIZE 32 + #define CALLBACK_LINK_OFFSET 48 + #endif +-#if defined(MODEL_ppc64le) ++#if _CALL_ELF == 2 + #define RESERVED_STACK 32 + #define PARAM_SAVE_AREA 0 + #define LR_SAVE 16 +@@ -82,7 +82,7 @@ + + #endif + +-#if defined(MODEL_ppc64) ++#if _CALL_ELF == 1 + #define FUNCTION(name) \ + .section ".opd","aw"; \ + .align 3; \ +@@ -98,7 +98,7 @@ + + #endif + +-#if defined(MODEL_ppc64le) ++#if _CALL_ELF == 2 + #define FUNCTION(name) \ + .section ".text"; \ + .globl name; \ +@@ -157,7 +157,7 @@ + + #endif + +-#if defined(MODEL_ppc64) ++#if _CALL_ELF == 1 + .section ".opd","aw" + #else + .section ".text" +@@ -338,14 +338,14 @@ FUNCTION(caml_c_call) + #if defined(MODEL_ppc) + mtctr 28 + bctrl +-#elif defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + ld 0, 0(28) + mr 26, 2 /* save current TOC in a callee-save register */ + mtctr 0 + ld 2, 8(28) + bctrl + mr 2, 26 /* restore current TOC */ +-#elif defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + mtctr 28 + mr 12, 28 + mr 26, 2 /* save current TOC in a callee-save register */ +@@ -514,14 +514,14 @@ FUNCTION(caml_start_program) + #if defined(MODEL_ppc) + mtctr 12 + .L105: bctrl +-#elif defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + ld 0, 0(12) + mtctr 0 + std 2, TOC_SAVE(1) + ld 2, 8(12) + .L105: bctrl + ld 2, TOC_SAVE(1) +-#elif defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + mtctr 12 + std 2, TOC_SAVE(1) + .L105: bctrl +@@ -634,7 +634,7 @@ FUNCTION(caml_callback3_exn) + b .L102 + ENDFUNCTION(caml_callback3_exn) + +-#if defined(MODEL_ppc64) ++#if _CALL_ELF == 1 + .section ".opd","aw" + #else + .section ".text" Added: head/lang/ocaml/files/patch-byterun_caml_stack.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/ocaml/files/patch-byterun_caml_stack.h Mon Dec 16 12:56:06 2019 (r520254) @@ -0,0 +1,15 @@ +--- byterun/caml/stack.h.orig 2017-07-13 08:56:44 UTC ++++ byterun/caml/stack.h +@@ -40,10 +40,10 @@ + #if defined(MODEL_ppc) + #define Saved_return_address(sp) *((intnat *)((sp) - 4)) + #define Callback_link(sp) ((struct caml_context *)((sp) + 16)) +-#elif defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + #define Saved_return_address(sp) *((intnat *)((sp) + 16)) + #define Callback_link(sp) ((struct caml_context *)((sp) + (48 + 32))) +-#elif defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + #define Saved_return_address(sp) *((intnat *)((sp) + 16)) + #define Callback_link(sp) ((struct caml_context *)((sp) + (32 + 32))) + #else Added: head/lang/ocaml/files/patch-testsuite_tests_asmcomp_power.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/ocaml/files/patch-testsuite_tests_asmcomp_power.S Mon Dec 16 12:56:06 2019 (r520254) @@ -0,0 +1,62 @@ +--- testsuite/tests/asmcomp/power.S.orig 2019-12-02 12:36:28 UTC ++++ testsuite/tests/asmcomp/power.S +@@ -26,11 +26,11 @@ + #define RESERVED_STACK 16 + #define LR_SAVE_AREA 4 + #endif +-#if defined(MODEL_ppc64) ++#if _CALL_ELF == 1 + #define RESERVED_STACK 48 + #define LR_SAVE_AREA 16 + #endif +-#if defined(MODEL_ppc64le) ++#if _CALL_ELF == 2 + #define RESERVED_STACK 32 + #define LR_SAVE_AREA 16 + #endif +@@ -46,7 +46,7 @@ + name: + #endif + +-#if defined(MODEL_ppc64) ++#if _CALL_ELF == 1 + #define FUNCTION(name) \ + .section ".opd","aw"; \ + .align 3; \ +@@ -58,7 +58,7 @@ + .L.name: + #endif + +-#if defined(MODEL_ppc64le) ++#if _CALL_ELF == 2 + #define FUNCTION(name) \ + .section ".text"; \ + .globl name; \ +@@ -118,11 +118,11 @@ FUNCTION(call_gen_code) + /* Get function pointer in CTR */ + #if defined(MODEL_ppc) + mtctr 3 +-#elif defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + ld 0, 0(3) + mtctr 0 + ld 2, 8(3) +-#elif defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + mtctr 3 + mr 12, 3 + #else +@@ -184,11 +184,11 @@ FUNCTION(caml_c_call) + /* Jump to C function (address in r28) */ + #if defined(MODEL_ppc) + mtctr 28 +-#elif defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + ld 0, 0(28) + mtctr 0 + ld 2, 8(28) +-#elif defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + mtctr 28 + mr 12, 28 + #else