From a31f1faf176f8b96509e06f0aed27915e8a733aa Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 27 Jan 2019 03:10:50 +0100 Subject: [PATCH] ocaml: add ppc64 patches [ci skip] --- .../ocaml/patches/ocaml-4.04.2-elfv2.patch | 198 ++++++++++++++++++ srcpkgs/ocaml/patches/ocaml-4.04.2-pie.patch | 20 ++ .../patches/ocaml-4.04.2-sigcontext.patch | 19 ++ srcpkgs/ocaml/template | 3 +- 4 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/ocaml/patches/ocaml-4.04.2-elfv2.patch create mode 100644 srcpkgs/ocaml/patches/ocaml-4.04.2-pie.patch create mode 100644 srcpkgs/ocaml/patches/ocaml-4.04.2-sigcontext.patch diff --git a/srcpkgs/ocaml/patches/ocaml-4.04.2-elfv2.patch b/srcpkgs/ocaml/patches/ocaml-4.04.2-elfv2.patch new file mode 100644 index 00000000000..d1d195765ca --- /dev/null +++ b/srcpkgs/ocaml/patches/ocaml-4.04.2-elfv2.patch @@ -0,0 +1,198 @@ +--- ocaml-4.04.2/asmcomp/power/arch.ml ++++ ocaml-4.04.2/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 + +--- ocaml-4.04.2/asmrun/power.S ++++ ocaml-4.04.2/asmrun/power.S +@@ -13,7 +13,7 @@ + /* */ + /**************************************************************************/ + +-#if defined(MODEL_ppc64le) ++#if _CALL_ELF == 2 + .abiversion 2 + #endif + +@@ -41,8 +41,7 @@ + #define TRAP_PREVIOUS_OFFSET 4 + #define CALLBACK_LINK_SIZE 16 + #define CALLBACK_LINK_OFFSET 0 +-#endif +-#if defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + #define RESERVED_STACK 48 + #define PARAM_SAVE_AREA (8*8) + #define LR_SAVE 16 +@@ -53,8 +52,7 @@ + #define TRAP_PREVIOUS_OFFSET 64 + #define CALLBACK_LINK_SIZE 32 + #define CALLBACK_LINK_OFFSET 48 +-#endif +-#if defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + #define RESERVED_STACK 32 + #define PARAM_SAVE_AREA 0 + #define LR_SAVE 16 +@@ -80,9 +78,8 @@ + #define ENDFUNCTION(name) \ + .size name, . - name + +-#endif + +-#if defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + #define FUNCTION(name) \ + .section ".opd","aw"; \ + .align 3; \ +@@ -96,9 +93,8 @@ + #define ENDFUNCTION(name) \ + .size name, . - .L.name + +-#endif + +-#if defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + #define FUNCTION(name) \ + .section ".text"; \ + .globl name; \ +@@ -157,7 +153,7 @@ + + #endif + +-#if defined(MODEL_ppc64) ++#if _CALL_ELF == 1 + .section ".opd","aw" + #else + .section ".text" +@@ -338,14 +334,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 +510,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 +630,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" +--- ocaml-4.04.2/testsuite/tests/asmgen/power.S ++++ ocaml-4.04.2/testsuite/tests/asmgen/power.S +@@ -25,12 +25,10 @@ + #if defined(MODEL_ppc) + #define RESERVED_STACK 16 + #define LR_SAVE_AREA 4 +-#endif +-#if defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + #define RESERVED_STACK 48 + #define LR_SAVE_AREA 16 +-#endif +-#if defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + #define RESERVED_STACK 32 + #define LR_SAVE_AREA 16 + #endif +@@ -44,9 +42,8 @@ + .type name, @function; \ + .align 2; \ + name: +-#endif + +-#if defined(MODEL_ppc64) ++#elif _CALL_ELF == 1 + #define FUNCTION(name) \ + .section ".opd","aw"; \ + .align 3; \ +@@ -56,9 +53,8 @@ + .text; \ + .align 2; \ + .L.name: +-#endif + +-#if defined(MODEL_ppc64le) ++#elif _CALL_ELF == 2 + #define FUNCTION(name) \ + .section ".text"; \ + .globl name; \ +@@ -118,11 +114,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 +180,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 +--- ocaml-4.04.2/byterun/caml/stack.h ++++ ocaml-4.04.2/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 diff --git a/srcpkgs/ocaml/patches/ocaml-4.04.2-pie.patch b/srcpkgs/ocaml/patches/ocaml-4.04.2-pie.patch new file mode 100644 index 00000000000..6aed5844d33 --- /dev/null +++ b/srcpkgs/ocaml/patches/ocaml-4.04.2-pie.patch @@ -0,0 +1,20 @@ +--- ocaml-4.04.2/asmcomp/emitaux.ml ++++ ocaml-4.04.2/asmcomp/emitaux.ml +@@ -205,6 +205,7 @@ let emit_frames a = + | None -> a.efa_word 0 + end + in ++ a.efa_align Arch.size_addr; + a.efa_word (List.length !frame_descriptors); + List.iter emit_frame !frame_descriptors; + Label_table.iter emit_debuginfo debuginfos; +--- ocaml-4.04.2/asmrun/power.S ++++ ocaml-4.04.2/asmrun/power.S +@@ -642,6 +642,7 @@ caml_system__code_end: + /* Frame table */ + + .section ".data" ++ .align wordalign + .globl caml_system__frametable + .type caml_system__frametable, @object + caml_system__frametable: diff --git a/srcpkgs/ocaml/patches/ocaml-4.04.2-sigcontext.patch b/srcpkgs/ocaml/patches/ocaml-4.04.2-sigcontext.patch new file mode 100644 index 00000000000..9cad3403931 --- /dev/null +++ b/srcpkgs/ocaml/patches/ocaml-4.04.2-sigcontext.patch @@ -0,0 +1,19 @@ +--- ocaml-4.04.2/asmrun/signals_osdep.h ++++ ocaml-4.04.2/asmrun/signals_osdep.h +@@ -297,11 +297,11 @@ + sigact.sa_flags = 0 + + typedef unsigned long context_reg; +- #define CONTEXT_PC (context->regs->nip) +- #define CONTEXT_EXCEPTION_POINTER (context->regs->gpr[29]) +- #define CONTEXT_YOUNG_LIMIT (context->regs->gpr[30]) +- #define CONTEXT_YOUNG_PTR (context->regs->gpr[31]) +- #define CONTEXT_SP (context->regs->gpr[1]) ++ #define CONTEXT_PC (context->gp_regs[32]) ++ #define CONTEXT_EXCEPTION_POINTER (context->gp_regs[29]) ++ #define CONTEXT_YOUNG_LIMIT (context->gp_regs[30]) ++ #define CONTEXT_YOUNG_PTR (context->gp_regs[31]) ++ #define CONTEXT_SP (context->gp_regs[1]) + + /****************** s390x, ELF (Linux) */ + #elif defined(TARGET_s390x) && defined(SYS_elf) diff --git a/srcpkgs/ocaml/template b/srcpkgs/ocaml/template index 38171c22bdf..08cf3a232ca 100644 --- a/srcpkgs/ocaml/template +++ b/srcpkgs/ocaml/template @@ -5,12 +5,13 @@ revision=1 makedepends="ncurses-devel libX11-devel" short_desc="The main implementation of the Caml language" maintainer="Leah Neukirchen " -homepage="http://ocaml.org/" license="QPL-1.0, LGPL-2.1-only" +homepage="http://ocaml.org/" distfiles="https://github.com/${pkgname}/${pkgname}/archive/${version}.tar.gz" checksum=83683ddad54bd23773591a9f757e702fa5cfa2ea1b124d8fe75a73729e592bfe nocross=yes disable_parallel_build=yes +patch_args="-Np1" do_configure() { ./configure -prefix /usr -mandir /usr/share/man -fPIC