From 0697d2019770eac441dccf39edbde6e90231783b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 28 May 2015 21:20:31 +0100 Subject: [PATCH] ppc64le: Fix calling convention of external functions with > 8 parameters (RHBZ#1225995). --- ...ore-.-configure-it-s-a-real-git-file.patch | 2 +- ...pilerlibs-directory-is-created-by-gi.patch | 2 +- 0003-Don-t-add-rpaths-to-libraries.patch | 2 +- ...amlplugininfo-Useful-utilities-from-.patch | 2 +- ...-Allow-user-defined-C-compiler-flags.patch | 2 +- 0006-Add-support-for-ppc64.patch | 2 +- 0007-ppc64-Update-for-OCaml-4.02.0.patch | 2 +- 0008-Add-support-for-ppc64le.patch | 2 +- 0009-ppc64le-Update-for-OCaml-4.02.0.patch | 2 +- ...m-arm64-Mark-stack-as-non-executable.patch | 2 +- ...-no_arg-and-get_arg-helper-functions.patch | 2 +- ...such-as-flag-arg-as-well-as-flag-arg.patch | 2 +- ...C99-types-u-int-32-64-_t-in-preferen.patch | 2 +- ...ppc64le-Mark-stack-as-non-executable.patch | 2 +- ...oc-Interim-definitions-for-op_is_pur.patch | 2 +- ...rrect-backtraces-in-gdb-on-AArch64.-.patch | 2 +- ...ing-convention-of-external-functions.patch | 34 +++++++++++++++++++ ocaml.spec | 7 +++- 18 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 0017-ppc64le-Fix-calling-convention-of-external-functions.patch diff --git a/0001-Don-t-ignore-.-configure-it-s-a-real-git-file.patch b/0001-Don-t-ignore-.-configure-it-s-a-real-git-file.patch index 2dee879..2ce42ee 100644 --- a/0001-Don-t-ignore-.-configure-it-s-a-real-git-file.patch +++ b/0001-Don-t-ignore-.-configure-it-s-a-real-git-file.patch @@ -1,7 +1,7 @@ From 607ae33eed09f9eafccda1276626e9c509dcbed1 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 22:29:38 +0100 -Subject: [PATCH 01/16] Don't ignore ./configure, it's a real git file. +Subject: [PATCH 01/17] Don't ignore ./configure, it's a real git file. --- .gitignore | 1 - diff --git a/0002-Ensure-empty-compilerlibs-directory-is-created-by-gi.patch b/0002-Ensure-empty-compilerlibs-directory-is-created-by-gi.patch index 76f645f..182b72f 100644 --- a/0002-Ensure-empty-compilerlibs-directory-is-created-by-gi.patch +++ b/0002-Ensure-empty-compilerlibs-directory-is-created-by-gi.patch @@ -1,7 +1,7 @@ From 89f29afc4aaa324585aa010289a4a58416d53700 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 7 Jun 2012 15:36:16 +0100 -Subject: [PATCH 02/16] Ensure empty compilerlibs/ directory is created by git. +Subject: [PATCH 02/17] Ensure empty compilerlibs/ directory is created by git. This directory exists in the OCaml tarball, but is empty. As a result, git ignores it unless we put a dummy file in it. diff --git a/0003-Don-t-add-rpaths-to-libraries.patch b/0003-Don-t-add-rpaths-to-libraries.patch index 5365dec..c16634b 100644 --- a/0003-Don-t-add-rpaths-to-libraries.patch +++ b/0003-Don-t-add-rpaths-to-libraries.patch @@ -1,7 +1,7 @@ From 10209519de242952ebdef608ab5f2f51a6c9e2b3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 03/16] Don't add rpaths to libraries. +Subject: [PATCH 03/17] Don't add rpaths to libraries. --- tools/Makefile.shared | 6 +++--- diff --git a/0004-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch b/0004-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch index 4168050..ee89ef4 100644 --- a/0004-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch +++ b/0004-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch @@ -1,7 +1,7 @@ From b360841d9b1eae64201d1ee7a1ff6dc5a5b0fa87 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:40:36 +0100 -Subject: [PATCH 04/16] ocamlbyteinfo, ocamlplugininfo: Useful utilities from +Subject: [PATCH 04/17] ocamlbyteinfo, ocamlplugininfo: Useful utilities from Debian, sent upstream. See: diff --git a/0005-configure-Allow-user-defined-C-compiler-flags.patch b/0005-configure-Allow-user-defined-C-compiler-flags.patch index eea05af..9d11fc5 100644 --- a/0005-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0005-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,7 +1,7 @@ From 6193266853d3667f18048989ebaaa0cbcb74afb5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 05/16] configure: Allow user defined C compiler flags. +Subject: [PATCH 05/17] configure: Allow user defined C compiler flags. --- configure | 4 ++++ diff --git a/0006-Add-support-for-ppc64.patch b/0006-Add-support-for-ppc64.patch index 4016047..bef5d80 100644 --- a/0006-Add-support-for-ppc64.patch +++ b/0006-Add-support-for-ppc64.patch @@ -1,7 +1,7 @@ From 5022b33b094d5a88c5c372b0873d81023f0d7bb4 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:47:07 +0100 -Subject: [PATCH 06/16] Add support for ppc64. +Subject: [PATCH 06/17] Add support for ppc64. Note (1): This patch was rejected upstream because they don't have appropriate hardware for testing. diff --git a/0007-ppc64-Update-for-OCaml-4.02.0.patch b/0007-ppc64-Update-for-OCaml-4.02.0.patch index b0225ea..ee589cf 100644 --- a/0007-ppc64-Update-for-OCaml-4.02.0.patch +++ b/0007-ppc64-Update-for-OCaml-4.02.0.patch @@ -1,7 +1,7 @@ From 834644b81c536fc81022a0a13f860fb33e3d78d2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 24 Oct 2014 12:59:23 +0200 -Subject: [PATCH 07/16] ppc64: Update for OCaml 4.02.0. +Subject: [PATCH 07/17] ppc64: Update for OCaml 4.02.0. These are based on the power (ppc32) branch and some guesswork. In particular, I'm not convinced that my changes to floating diff --git a/0008-Add-support-for-ppc64le.patch b/0008-Add-support-for-ppc64le.patch index b63e8b9..ceffd8f 100644 --- a/0008-Add-support-for-ppc64le.patch +++ b/0008-Add-support-for-ppc64le.patch @@ -1,7 +1,7 @@ From c89bde7d3563e2c7bb725272334fabf53044bd9c Mon Sep 17 00:00:00 2001 From: Michel Normand Date: Tue, 18 Mar 2014 09:15:47 -0400 -Subject: [PATCH 08/16] Add support for ppc64le. +Subject: [PATCH 08/17] Add support for ppc64le. Signed-off-by: Michel Normand --- diff --git a/0009-ppc64le-Update-for-OCaml-4.02.0.patch b/0009-ppc64le-Update-for-OCaml-4.02.0.patch index 9eef53d..84d3329 100644 --- a/0009-ppc64le-Update-for-OCaml-4.02.0.patch +++ b/0009-ppc64le-Update-for-OCaml-4.02.0.patch @@ -1,7 +1,7 @@ From 8d86aba4983a254f36f2f1758079b3099ba5fc07 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 24 Oct 2014 12:59:23 +0200 -Subject: [PATCH 09/16] ppc64le: Update for OCaml 4.02.0. +Subject: [PATCH 09/17] ppc64le: Update for OCaml 4.02.0. These are based on the power (ppc32) branch and some guesswork. In particular, I'm not convinced that my changes to floating point diff --git a/0010-arm-arm64-Mark-stack-as-non-executable.patch b/0010-arm-arm64-Mark-stack-as-non-executable.patch index 013d213..234d762 100644 --- a/0010-arm-arm64-Mark-stack-as-non-executable.patch +++ b/0010-arm-arm64-Mark-stack-as-non-executable.patch @@ -1,7 +1,7 @@ From 4d08d0e8511e247a96440693b73773c72b04fee2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 10 May 2014 03:20:35 -0400 -Subject: [PATCH 10/16] arm, arm64: Mark stack as non-executable. +Subject: [PATCH 10/17] arm, arm64: Mark stack as non-executable. The same fix as this one, which was only fully applied to i686 & x86-64: diff --git a/0011-arg-Add-no_arg-and-get_arg-helper-functions.patch b/0011-arg-Add-no_arg-and-get_arg-helper-functions.patch index df362a3..67482f0 100644 --- a/0011-arg-Add-no_arg-and-get_arg-helper-functions.patch +++ b/0011-arg-Add-no_arg-and-get_arg-helper-functions.patch @@ -1,7 +1,7 @@ From 8ee89eee0500d17ffb91aa2febdeb6792ac53f27 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 1 Apr 2014 11:17:07 +0100 -Subject: [PATCH 11/16] arg: Add no_arg and get_arg helper functions. +Subject: [PATCH 11/17] arg: Add no_arg and get_arg helper functions. The no_arg function in this patch is a no-op. It will do something useful in the followups. diff --git a/0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch b/0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch index 9e57d1c..b7bb135 100644 --- a/0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch +++ b/0012-arg-Allow-flags-such-as-flag-arg-as-well-as-flag-arg.patch @@ -1,7 +1,7 @@ From 350eab7918f0adf385e01411ae6fed3e0579145f Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 1 Apr 2014 11:21:40 +0100 -Subject: [PATCH 12/16] arg: Allow flags such as --flag=arg as well as --flag +Subject: [PATCH 12/17] arg: Allow flags such as --flag=arg as well as --flag arg. Allow flags to be followed directly by their argument, separated by an '=' diff --git a/0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch b/0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch index d5e8645..50d2c07 100644 --- a/0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch +++ b/0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch @@ -1,7 +1,7 @@ From 4072cbf56bba989f87783f285952d7227ba5898d Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 27 Aug 2014 09:58:33 +0000 -Subject: [PATCH 13/16] PR#6517: use ISO C99 types {,u}int{32,64}_t in +Subject: [PATCH 13/17] PR#6517: use ISO C99 types {,u}int{32,64}_t in preference to our homegrown types {,u}int{32,64}. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15131 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 diff --git a/0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch b/0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch index 9757e4f..d2fde4b 100644 --- a/0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch +++ b/0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch @@ -1,7 +1,7 @@ From 8e493f90181b8b592185b2f9322575113b5ff7d5 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 11 Sep 2014 14:49:54 +0100 -Subject: [PATCH 14/16] ppc, ppc64, ppc64le: Mark stack as non-executable. +Subject: [PATCH 14/17] ppc, ppc64, ppc64le: Mark stack as non-executable. The same fix as this one, which was only fully applied to i686 & x86-64: diff --git a/0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch b/0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch index 4e165c5..947a23d 100644 --- a/0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch +++ b/0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch @@ -1,7 +1,7 @@ From df5201a35d02a13ad7ffd6fb38252851910cae43 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 24 Oct 2014 10:10:54 +0100 -Subject: [PATCH 15/16] ppc64/ppc64le: proc: Interim definitions for op_is_pure +Subject: [PATCH 15/17] ppc64/ppc64le: proc: Interim definitions for op_is_pure and regs_are_volatile. See: https://bugzilla.redhat.com/show_bug.cgi?id=1156300 diff --git a/0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch b/0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch index b45cebf..6f2918b 100644 --- a/0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch +++ b/0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch @@ -1,7 +1,7 @@ From d3ca0ccc0eccfecd4aa922decf99ca7d67d40fa7 Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Wed, 6 May 2015 17:37:43 +0000 -Subject: [PATCH 16/16] Fix PR#6490: incorrect backtraces in gdb on AArch64. +Subject: [PATCH 16/17] Fix PR#6490: incorrect backtraces in gdb on AArch64. (Also fixes the same problem for 32-bit ARM.) git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@16091 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 diff --git a/0017-ppc64le-Fix-calling-convention-of-external-functions.patch b/0017-ppc64le-Fix-calling-convention-of-external-functions.patch new file mode 100644 index 0000000..9620f0d --- /dev/null +++ b/0017-ppc64le-Fix-calling-convention-of-external-functions.patch @@ -0,0 +1,34 @@ +From 5b7d4c5d1407115c2c685987be2669a9b0aafa78 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 28 May 2015 16:13:40 -0400 +Subject: [PATCH 17/17] ppc64le: Fix calling convention of external functions + with > 8 parameters (RHBZ#1225995). + +For external (ie. C) functions with more than 8 parameters, we must +pass the first 8 parameters in registers and then all the remaining +parameters on the stack. + +Unfortunately the original backend copied the stack offset from ppc64, +where it works, but the offset was wrong for ppc64le. + +By experimentation I found the correct offset. +--- + asmcomp/power64le/proc.ml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/asmcomp/power64le/proc.ml b/asmcomp/power64le/proc.ml +index 56473ac..c705695 100644 +--- a/asmcomp/power64le/proc.ml ++++ b/asmcomp/power64le/proc.ml +@@ -188,7 +188,7 @@ let poweropen_external_conventions first_int last_int + let loc_external_arguments = + match Config.system with + | "rhapsody" -> poweropen_external_conventions 0 7 100 112 +- | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 48 ++ | "elf" | "bsd" -> calling_conventions 0 7 100 107 outgoing 32 + | _ -> assert false + + let extcall_use_push = false +-- +2.3.1 + diff --git a/ocaml.spec b/ocaml.spec index 1772cc8..598e1b1 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -17,7 +17,7 @@ Name: ocaml Version: 4.02.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: OCaml compiler and programming environment @@ -61,6 +61,7 @@ Patch0013: 0013-PR-6517-use-ISO-C99-types-u-int-32-64-_t-in-preferen.patch Patch0014: 0014-ppc-ppc64-ppc64le-Mark-stack-as-non-executable.patch Patch0015: 0015-ppc64-ppc64le-proc-Interim-definitions-for-op_is_pur.patch Patch0016: 0016-Fix-PR-6490-incorrect-backtraces-in-gdb-on-AArch64.-.patch +Patch0017: 0017-ppc64le-Fix-calling-convention-of-external-functions.patch # Add BFD support so that ocamlobjinfo supports *.cmxs format (RHBZ#1113735). BuildRequires: binutils-devel @@ -422,6 +423,10 @@ fi %changelog +* Thu May 28 2015 Richard W.M. Jones - 4.02.1-5 +- ppc64le: Fix calling convention of external functions with > 8 parameters + (RHBZ#1225995). + * Wed May 6 2015 Richard W.M. Jones - 4.02.1-4 - Fix gdb stack traces on aarch64 (upstream PR6490). Thanks: Mark Shinwell.