From 6fbb4db452cad948a903b0124d1c75f6b06a6833 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 5 Sep 2022 16:21:34 +0100 Subject: [PATCH] Include more upstream patches from 4.14 branch Don't use %configure macro because that breaks on riscv64. https://bugzilla.redhat.com/2124272 --- ...arning-when-calling-virtual-methods-.patch | 6 +- ...st-11236-from-Nymphium-missing-since.patch | 6 +- ...preprocessor-conditional-on-_MSC_VER.patch | 6 +- 0004-Changes.patch | 6 +- ...more-instances-of-undefined-_MSC_VER.patch | 6 +- ...entation-for-string_of_float-.-11353.patch | 95 +++++ ...st-11380-from-damiendoligez-fix-fort.patch | 30 ++ ...tialization-of-bytecode-threading-11.patch | 101 ++++++ ...-incorrect-assumption-about-cross-co.patch | 67 ---- ...st-11397-from-Octachron-tast_mapper_.patch | 49 +++ ...l-request-11396-from-gasche-fix11392.patch | 85 +++++ ...t-limitation-on-caml_callbackN-11409.patch | 53 +++ ...lib-on-created-installed-libraries-1.patch | 327 ++++++++++++++++++ ...ay-2-has-gfortran.sh-don-t-print-any.patch | 27 ++ ...st-11417-from-lpw25-fix-virtual-clas.patch | 147 ++++++++ ...-whole-module-type-error-message-114.patch | 154 +++++++++ ...est-11373-from-dra27-flexlink-detect.patch | 57 +++ ...est-11468-from-dra27-i686-mingw-ipv6.patch | 55 +++ ...llocation-of-alternate-signal-stack-.patch | 194 +++++++++++ ...st-11487-from-purplearmadillo77-fma_.patch | 54 +++ 0020-Fixup-Changes.patch | 36 ++ ...utable-which-couldn-t-be-triggered.-.patch | 90 +++++ ...> 0022-Don-t-add-rpaths-to-libraries.patch | 12 +- ...-Allow-user-defined-C-compiler-flags.patch | 10 +- ...nly-use-OC_-for-building-executables.patch | 8 +- ocaml.spec | 51 ++- 26 files changed, 1622 insertions(+), 110 deletions(-) create mode 100644 0006-Better-documentation-for-string_of_float-.-11353.patch create mode 100644 0007-Merge-pull-request-11380-from-damiendoligez-fix-fort.patch create mode 100644 0008-Refactor-the-initialization-of-bytecode-threading-11.patch delete mode 100644 0008-configure-Remove-incorrect-assumption-about-cross-co.patch create mode 100644 0009-Merge-pull-request-11397-from-Octachron-tast_mapper_.patch create mode 100644 0010-Merge-pull-request-11396-from-gasche-fix11392.patch create mode 100644 0011-Document-limitation-on-caml_callbackN-11409.patch create mode 100644 0012-Stop-calling-ranlib-on-created-installed-libraries-1.patch create mode 100644 0013-tests-lib-bigarray-2-has-gfortran.sh-don-t-print-any.patch create mode 100644 0014-Merge-pull-request-11417-from-lpw25-fix-virtual-clas.patch create mode 100644 0015-Do-not-elide-the-whole-module-type-error-message-114.patch create mode 100644 0016-Merge-pull-request-11373-from-dra27-flexlink-detect.patch create mode 100644 0017-Merge-pull-request-11468-from-dra27-i686-mingw-ipv6.patch create mode 100644 0018-More-prudent-deallocation-of-alternate-signal-stack-.patch create mode 100644 0019-Merge-pull-request-11487-from-purplearmadillo77-fma_.patch create mode 100644 0020-Fixup-Changes.patch create mode 100644 0021-Fix-deprecated_mutable-which-couldn-t-be-triggered.-.patch rename 0006-Don-t-add-rpaths-to-libraries.patch => 0022-Don-t-add-rpaths-to-libraries.patch (69%) rename 0007-configure-Allow-user-defined-C-compiler-flags.patch => 0023-configure-Allow-user-defined-C-compiler-flags.patch (71%) rename 0009-configure-Only-use-OC_-for-building-executables.patch => 0024-configure-Only-use-OC_-for-building-executables.patch (83%) diff --git a/0001-Do-not-trigger-warning-when-calling-virtual-methods-.patch b/0001-Do-not-trigger-warning-when-calling-virtual-methods-.patch index d89a4ac..166e69a 100644 --- a/0001-Do-not-trigger-warning-when-calling-virtual-methods-.patch +++ b/0001-Do-not-trigger-warning-when-calling-virtual-methods-.patch @@ -1,7 +1,7 @@ -From 3f6a90f1ac47c480522a009d6ea56e2acfb7112f Mon Sep 17 00:00:00 2001 +From 2912ed4fde14e34b58c482cb81fb88676ab3ffc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ojeda=20B=C3=A4r?= Date: Wed, 27 Apr 2022 14:46:47 +0200 -Subject: [PATCH 1/9] Do not trigger warning when calling virtual methods +Subject: [PATCH 01/24] Do not trigger warning when calling virtual methods introduced by constraining "self" (#11204) (cherry picked from commit 1e7af3f6261502bb384dc9e23a74ad0990bfd854) @@ -188,5 +188,5 @@ index 048ee998b0..fedbc0e025 100644 begin match final with | Not_final -> () -- -2.36.1 +2.37.0.rc2 diff --git a/0002-Merge-pull-request-11236-from-Nymphium-missing-since.patch b/0002-Merge-pull-request-11236-from-Nymphium-missing-since.patch index 3e043a5..9c75989 100644 --- a/0002-Merge-pull-request-11236-from-Nymphium-missing-since.patch +++ b/0002-Merge-pull-request-11236-from-Nymphium-missing-since.patch @@ -1,7 +1,7 @@ -From 538cb5217642b36a8eab1ae027767c344e880b4b Mon Sep 17 00:00:00 2001 +From 623258a6517c8ec1d9e5f41cbdc05205a0e6ee1d Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Thu, 5 May 2022 20:01:44 +0100 -Subject: [PATCH 2/9] Merge pull request #11236 from Nymphium/missing-since2 +Subject: [PATCH 02/24] Merge pull request #11236 from Nymphium/missing-since2 Add missing @since annotation to Gc.eventlog_pause @@ -39,5 +39,5 @@ index b211197fd4..8031eeb8df 100644 (** [Memprof] is a sampling engine for allocated memory words. Every -- -2.36.1 +2.37.0.rc2 diff --git a/0003-misc.h-fix-preprocessor-conditional-on-_MSC_VER.patch b/0003-misc.h-fix-preprocessor-conditional-on-_MSC_VER.patch index 2484e29..3854e05 100644 --- a/0003-misc.h-fix-preprocessor-conditional-on-_MSC_VER.patch +++ b/0003-misc.h-fix-preprocessor-conditional-on-_MSC_VER.patch @@ -1,7 +1,7 @@ -From c06ca224780f005b625ef406a817ead3eb9a8665 Mon Sep 17 00:00:00 2001 +From d497565758b5c80d8a7bf4cad02e5a4558ae6b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ojeda=20B=C3=A4r?= Date: Tue, 17 May 2022 10:21:34 +0200 -Subject: [PATCH 3/9] misc.h: fix preprocessor conditional on _MSC_VER +Subject: [PATCH 03/24] misc.h: fix preprocessor conditional on _MSC_VER (cherry picked from commit 253d605e10865371aed45967a94caed0642b7583) --- @@ -22,5 +22,5 @@ index 5915c30a7b..494d45e8f8 100644 #define CAMLdeprecated_typedef(name, type) \ typedef __declspec(deprecated) type name -- -2.36.1 +2.37.0.rc2 diff --git a/0004-Changes.patch b/0004-Changes.patch index fa96bd5..214e89e 100644 --- a/0004-Changes.patch +++ b/0004-Changes.patch @@ -1,7 +1,7 @@ -From bfb9a2157c50c1b4a9cb8dc0319fe375b5e80b1d Mon Sep 17 00:00:00 2001 +From d2b9da6f7aff410e8a1499637ae88aaf0a135c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ojeda=20B=C3=A4r?= Date: Tue, 17 May 2022 14:45:26 +0200 -Subject: [PATCH 4/9] Changes +Subject: [PATCH 04/24] Changes (cherry picked from commit 9a157026f115364635f8fe0ae5805e15ef071de0) --- @@ -24,5 +24,5 @@ index 931a74b8d1..fdfffd78bb 100644 ---------------------------- -- -2.36.1 +2.37.0.rc2 diff --git a/0005-Guard-more-instances-of-undefined-_MSC_VER.patch b/0005-Guard-more-instances-of-undefined-_MSC_VER.patch index da39f67..d9f81d7 100644 --- a/0005-Guard-more-instances-of-undefined-_MSC_VER.patch +++ b/0005-Guard-more-instances-of-undefined-_MSC_VER.patch @@ -1,7 +1,7 @@ -From 53ce1f582e37faabfd616a0b09521497e2e7ef14 Mon Sep 17 00:00:00 2001 +From 513164232d897c39c4e571a7a8f167dee5c146b3 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Wed, 18 May 2022 12:48:33 +0100 -Subject: [PATCH 5/9] Guard more instances of undefined _MSC_VER +Subject: [PATCH 05/24] Guard more instances of undefined _MSC_VER --- Changes | 8 +++++--- @@ -89,5 +89,5 @@ index 494d45e8f8..c605f8711e 100644 __pragma( warning (disable:4189 ) ) #define CAMLunused_end __pragma( warning (pop)) -- -2.36.1 +2.37.0.rc2 diff --git a/0006-Better-documentation-for-string_of_float-.-11353.patch b/0006-Better-documentation-for-string_of_float-.-11353.patch new file mode 100644 index 0000000..935a992 --- /dev/null +++ b/0006-Better-documentation-for-string_of_float-.-11353.patch @@ -0,0 +1,95 @@ +From fa904a7d3c89c2ad18a426017aeda5bb0d7dd8bd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fran=C3=A7ois=20Pottier?= + +Date: Fri, 24 Jun 2022 16:37:13 +0200 +Subject: [PATCH 06/24] Better documentation for [string_of_float]. (#11353) + +Better documentation for [string_of_float] (and [Float.to_string]) +with similar warnings for [print_float] and [prerr_float] in a similar way. + +(cherry picked from commit 40113fbc73930b41a7a2df468de18c94feeefdf5) +--- + stdlib/float.mli | 7 ++++++- + stdlib/stdlib.mli | 15 ++++++++++++--- + stdlib/templates/float.template.mli | 7 ++++++- + 3 files changed, 24 insertions(+), 5 deletions(-) + +diff --git a/stdlib/float.mli b/stdlib/float.mli +index ba84d9b0e2..93d2f3016d 100644 +--- a/stdlib/float.mli ++++ b/stdlib/float.mli +@@ -178,7 +178,12 @@ val of_string_opt: string -> float option + (** Same as [of_string], but returns [None] instead of raising. *) + + val to_string : float -> string +-(** Return the string representation of a floating-point number. *) ++(** Return a string representation of a floating-point number. ++ ++ This conversion can involve a loss of precision. For greater control over ++ the manner in which the number is printed, see {!Printf}. ++ ++ This function is an alias for {!Stdlib.string_of_float}. *) + + type fpclass = Stdlib.fpclass = + FP_normal (** Normal number, none of the below *) +diff --git a/stdlib/stdlib.mli b/stdlib/stdlib.mli +index 237adfbdd8..0eaee2716e 100644 +--- a/stdlib/stdlib.mli ++++ b/stdlib/stdlib.mli +@@ -776,7 +776,10 @@ external int_of_string : string -> int = "caml_int_of_string" + [Failure "int_of_string"] instead of returning [None]. *) + + val string_of_float : float -> string +-(** Return the string representation of a floating-point number. *) ++(** Return a string representation of a floating-point number. ++ ++ This conversion can involve a loss of precision. For greater control over ++ the manner in which the number is printed, see {!Printf}. *) + + val float_of_string_opt: string -> float option + (** Convert the given string to a float. The string is read in decimal +@@ -861,7 +864,10 @@ val print_int : int -> unit + (** Print an integer, in decimal, on standard output. *) + + val print_float : float -> unit +-(** Print a floating-point number, in decimal, on standard output. *) ++(** Print a floating-point number, in decimal, on standard output. ++ ++ The conversion of the number to a string uses {!string_of_float} and ++ can involve a loss of precision. *) + + val print_endline : string -> unit + (** Print a string, followed by a newline character, on +@@ -889,7 +895,10 @@ val prerr_int : int -> unit + (** Print an integer, in decimal, on standard error. *) + + val prerr_float : float -> unit +-(** Print a floating-point number, in decimal, on standard error. *) ++(** Print a floating-point number, in decimal, on standard error. ++ ++ The conversion of the number to a string uses {!string_of_float} and ++ can involve a loss of precision. *) + + val prerr_endline : string -> unit + (** Print a string, followed by a newline character on standard +diff --git a/stdlib/templates/float.template.mli b/stdlib/templates/float.template.mli +index e35c01809f..e2f7411a02 100644 +--- a/stdlib/templates/float.template.mli ++++ b/stdlib/templates/float.template.mli +@@ -178,7 +178,12 @@ val of_string_opt: string -> float option + (** Same as [of_string], but returns [None] instead of raising. *) + + val to_string : float -> string +-(** Return the string representation of a floating-point number. *) ++(** Return a string representation of a floating-point number. ++ ++ This conversion can involve a loss of precision. For greater control over ++ the manner in which the number is printed, see {!Printf}. ++ ++ This function is an alias for {!Stdlib.string_of_float}. *) + + type fpclass = Stdlib.fpclass = + FP_normal (** Normal number, none of the below *) +-- +2.37.0.rc2 + diff --git a/0007-Merge-pull-request-11380-from-damiendoligez-fix-fort.patch b/0007-Merge-pull-request-11380-from-damiendoligez-fix-fort.patch new file mode 100644 index 0000000..b57c6ba --- /dev/null +++ b/0007-Merge-pull-request-11380-from-damiendoligez-fix-fort.patch @@ -0,0 +1,30 @@ +From 05874f93adc60f16ccd5cbeef1e2ff010cef12c1 Mon Sep 17 00:00:00 2001 +From: Florian Angeletti +Date: Fri, 1 Jul 2022 14:41:25 +0200 +Subject: [PATCH 07/24] Merge pull request #11380 from + damiendoligez/fix-fortran-test-on-macos + +fix gfortran test on Macos + +(cherry picked from commit d7a2e0fa7f2df9bd178109ba9725bb074affbd5c) +--- + testsuite/tests/lib-bigarray-2/has-gfortran.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/testsuite/tests/lib-bigarray-2/has-gfortran.sh b/testsuite/tests/lib-bigarray-2/has-gfortran.sh +index 82f7ae8aee..051122113a 100644 +--- a/testsuite/tests/lib-bigarray-2/has-gfortran.sh ++++ b/testsuite/tests/lib-bigarray-2/has-gfortran.sh +@@ -5,6 +5,9 @@ if ! which gfortran > /dev/null 2>&1; then + elif ! grep -q '^CC=gcc' ${ocamlsrcdir}/Makefile.config; then + echo "OCaml was not compiled with gcc" > ${ocamltest_response} + test_result=${TEST_SKIP} ++elif gcc --version 2>&1 | grep 'Apple clang version'; then ++ echo "OCaml was not compiled with gcc" > ${ocamltest_response} ++ test_result=${TEST_SKIP} + else + test_result=${TEST_PASS} + fi +-- +2.37.0.rc2 + diff --git a/0008-Refactor-the-initialization-of-bytecode-threading-11.patch b/0008-Refactor-the-initialization-of-bytecode-threading-11.patch new file mode 100644 index 0000000..d6b3510 --- /dev/null +++ b/0008-Refactor-the-initialization-of-bytecode-threading-11.patch @@ -0,0 +1,101 @@ +From b9afeb8b8dc8c32f9f1c74c8402de9e6265e9d5f Mon Sep 17 00:00:00 2001 +From: Xavier Leroy +Date: Fri, 1 Jul 2022 17:14:44 +0200 +Subject: [PATCH 08/24] Refactor the initialization of bytecode threading + (#11378) + +Refactor the initialization of bytecode threading + +Use a function `caml_init_thread_code` instead of exposing global variables +`caml_instr_table` and `caml_instr_base`. + +This should silence the GCC 12 "dangling-pointer" warning. + +Fixes: #11358 +--- + Changes | 5 +++++ + runtime/caml/fix_code.h | 3 +-- + runtime/fix_code.c | 10 ++++++++-- + runtime/interp.c | 7 +++---- + 4 files changed, 17 insertions(+), 8 deletions(-) + +diff --git a/Changes b/Changes +index 590268262d..7ea4475b8d 100644 +--- a/Changes ++++ b/Changes +@@ -14,6 +14,11 @@ OCaml 4.14 maintenance branch + (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and + Sebastien Hinderer) + ++- #11358, #11378: Refactor the initialization of bytecode threading. ++ This avoids a "dangling pointer" warning of GCC 12.1. ++ (Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer) ++ ++ + OCaml 4.14.0 (28 March 2022) + ---------------------------- + +diff --git a/runtime/caml/fix_code.h b/runtime/caml/fix_code.h +index 83c393a17d..2eafaa814b 100644 +--- a/runtime/caml/fix_code.h ++++ b/runtime/caml/fix_code.h +@@ -34,8 +34,7 @@ void caml_set_instruction (code_t pos, opcode_t instr); + int caml_is_instruction (opcode_t instr1, opcode_t instr2); + + #ifdef THREADED_CODE +-extern char ** caml_instr_table; +-extern char * caml_instr_base; ++void caml_init_thread_code(void ** instr_table, void * instr_base); + void caml_thread_code (code_t code, asize_t len); + #endif + +diff --git a/runtime/fix_code.c b/runtime/fix_code.c +index aa059be5df..5584019867 100644 +--- a/runtime/fix_code.c ++++ b/runtime/fix_code.c +@@ -82,8 +82,14 @@ void caml_fixup_endianness(code_t code, asize_t len) + + #ifdef THREADED_CODE + +-char ** caml_instr_table; +-char * caml_instr_base; ++static char ** caml_instr_table; ++static char * caml_instr_base; ++ ++void caml_init_thread_code(void ** instr_table, void * instr_base) ++{ ++ caml_instr_table = (char **) instr_table; ++ caml_instr_base = (char *) instr_base; ++} + + static int* opcode_nargs = NULL; + int* caml_init_opcode_nargs(void) +diff --git a/runtime/interp.c b/runtime/interp.c +index a59811c87d..e6700994bc 100644 +--- a/runtime/interp.c ++++ b/runtime/interp.c +@@ -50,9 +50,9 @@ sp is a local copy of the global variable Caml_state->extern_sp. */ + #ifdef THREADED_CODE + # define Instruct(name) lbl_##name + # if defined(ARCH_SIXTYFOUR) && !defined(ARCH_CODE32) +-# define Jumptbl_base ((char *) &&lbl_ACC0) ++# define Jumptbl_base &&lbl_ACC0 + # else +-# define Jumptbl_base ((char *) 0) ++# define Jumptbl_base 0 + # define jumptbl_base ((char *) 0) + # endif + # ifdef DEBUG +@@ -249,8 +249,7 @@ value caml_interprete(code_t prog, asize_t prog_size) + + if (prog == NULL) { /* Interpreter is initializing */ + #ifdef THREADED_CODE +- caml_instr_table = (char **) jumptable; +- caml_instr_base = Jumptbl_base; ++ caml_init_thread_code(jumptable, Jumptbl_base); + #endif + return Val_unit; + } +-- +2.37.0.rc2 + diff --git a/0008-configure-Remove-incorrect-assumption-about-cross-co.patch b/0008-configure-Remove-incorrect-assumption-about-cross-co.patch deleted file mode 100644 index 3536a98..0000000 --- a/0008-configure-Remove-incorrect-assumption-about-cross-co.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 41d5e2db7a4667560d6aedda11a3c6a80c8f1b83 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Fri, 26 Apr 2019 16:16:29 +0100 -Subject: [PATCH 8/9] configure: Remove incorrect assumption about - cross-compiling. - -See https://github.com/ocaml/ocaml/issues/8647#issuecomment-487094390 - -The error seen without this patch is: - -sh: line 1: x86_64-pc-linux-gnu-as: command not found ---- - configure.ac | 31 ++++++++++++++++--------------- - 1 file changed, 16 insertions(+), 15 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 5ccfe8fb01..c763310acb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -578,10 +578,11 @@ AS_IF( - - # Are we building a cross-compiler - --AS_IF( -- [test x"$host" = x"$target"], -- [cross_compiler=false], -- [cross_compiler=true]) -+#AS_IF( -+# [test x"$host" = x"$target"], -+# [cross_compiler=false], -+# [cross_compiler=true]) -+cross_compiler=false - - # Checks for programs - -@@ -1212,17 +1213,17 @@ AS_CASE([$arch], - - # Assembler - --AS_IF([test -n "$target_alias"], -- [toolpref="${target_alias}-" -- as_target="$target" -- as_cpu="$target_cpu"], -- [AS_IF([test -n "$host_alias"], -- [toolpref="${host_alias}-" -- as_target="$host" -- as_cpu="$host_cpu"], -- [toolpref="" -- as_target="$build" -- as_cpu="$build_cpu"])]) -+dnl AS_IF([test -n "$target_alias"], -+dnl [toolpref="${target_alias}-" -+dnl as_target="$target" -+dnl as_cpu="$target_cpu"], -+dnl [AS_IF([test -n "$host_alias"], -+dnl [toolpref="${host_alias}-" -+dnl as_target="$host" -+dnl as_cpu="$host_cpu"], -+dnl [toolpref="" -+dnl as_target="$build" -+dnl as_cpu="$build_cpu"])]) - - # Finding the assembler - # The OCaml build system distinguishes two different assemblers: --- -2.36.1 - diff --git a/0009-Merge-pull-request-11397-from-Octachron-tast_mapper_.patch b/0009-Merge-pull-request-11397-from-Octachron-tast_mapper_.patch new file mode 100644 index 0000000..7f1ef7e --- /dev/null +++ b/0009-Merge-pull-request-11397-from-Octachron-tast_mapper_.patch @@ -0,0 +1,49 @@ +From 7315c73e283eca4313403e959241d86d63f88d58 Mon Sep 17 00:00:00 2001 +From: Gabriel Scherer +Date: Tue, 5 Jul 2022 09:27:54 +0200 +Subject: [PATCH 09/24] Merge pull request #11397 from + Octachron/tast_mapper_fix_for_with_modtype + + #11387: clean up envs inside Twith_modtype(subst) + +(cherry picked from commit d9afa408c612e74a266b95f0fa25bb1efde72112) +--- + Changes | 3 +++ + typing/tast_mapper.ml | 6 +++--- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/Changes b/Changes +index 7ea4475b8d..0fe7732a02 100644 +--- a/Changes ++++ b/Changes +@@ -18,6 +18,9 @@ OCaml 4.14 maintenance branch + This avoids a "dangling pointer" warning of GCC 12.1. + (Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer) + ++- #11387, module type with constraints no longer crash the compiler in presence ++ of both shadowing warnings and the `-bin-annot` compiler flag. ++ (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer) + + OCaml 4.14.0 (28 March 2022) + ---------------------------- +diff --git a/typing/tast_mapper.ml b/typing/tast_mapper.ml +index 6d359a59a7..9eb7f64e88 100644 +--- a/typing/tast_mapper.ml ++++ b/typing/tast_mapper.ml +@@ -458,10 +458,10 @@ let module_type sub x = + let with_constraint sub = function + | Twith_type decl -> Twith_type (sub.type_declaration sub decl) + | Twith_typesubst decl -> Twith_typesubst (sub.type_declaration sub decl) ++ | Twith_modtype mty -> Twith_modtype (sub.module_type sub mty) ++ | Twith_modtypesubst mty -> Twith_modtypesubst (sub.module_type sub mty) + | Twith_module _ +- | Twith_modsubst _ +- | Twith_modtype _ +- | Twith_modtypesubst _ as d -> d ++ | Twith_modsubst _ as d -> d + + let open_description sub od = + {od with open_env = sub.env sub od.open_env} +-- +2.37.0.rc2 + diff --git a/0010-Merge-pull-request-11396-from-gasche-fix11392.patch b/0010-Merge-pull-request-11396-from-gasche-fix11392.patch new file mode 100644 index 0000000..0b9cbd6 --- /dev/null +++ b/0010-Merge-pull-request-11396-from-gasche-fix11392.patch @@ -0,0 +1,85 @@ +From 9f72a2a2fec0902aeae5e5082779bb197657c1f4 Mon Sep 17 00:00:00 2001 +From: Gabriel Scherer +Date: Tue, 5 Jul 2022 10:38:50 +0200 +Subject: [PATCH 10/24] Merge pull request #11396 from gasche/fix11392 + +Fix 11392 (assertion failure on external with -rectypes) + +(cherry picked from commit 724cefb8b0f1f96ef5181fffc24975ac9460ce3e) +--- + Changes | 3 ++ + testsuite/tests/typing-external/pr11392.ml | 34 ++++++++++++++++++++++ + typing/typedecl.ml | 2 +- + 3 files changed, 38 insertions(+), 1 deletion(-) + create mode 100644 testsuite/tests/typing-external/pr11392.ml + +diff --git a/Changes b/Changes +index 0fe7732a02..8182f5ced7 100644 +--- a/Changes ++++ b/Changes +@@ -22,6 +22,9 @@ OCaml 4.14 maintenance branch + of both shadowing warnings and the `-bin-annot` compiler flag. + (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer) + ++- #11392, #11392: assertion failure with -rectypes and external definitions ++ (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev) ++ + OCaml 4.14.0 (28 March 2022) + ---------------------------- + +diff --git a/testsuite/tests/typing-external/pr11392.ml b/testsuite/tests/typing-external/pr11392.ml +new file mode 100644 +index 0000000000..91c8ea77eb +--- /dev/null ++++ b/testsuite/tests/typing-external/pr11392.ml +@@ -0,0 +1,34 @@ ++(* TEST ++ * expect ++*) ++ ++type 'self nat = ++ | Z ++ | S of 'self ++;; ++[%%expect{| ++type 'self nat = Z | S of 'self ++|}] ++ ++ ++ ++(* without rectypes: rejected *) ++external cast : int -> 'self nat as 'self = "%identity" ++;; ++[%%expect{| ++Line 1, characters 16-41: ++1 | external cast : int -> 'self nat as 'self = "%identity" ++ ^^^^^^^^^^^^^^^^^^^^^^^^^ ++Error: This alias is bound to type int -> 'a nat ++ but is used as an instance of type 'a ++ The type variable 'a occurs inside int -> 'a nat ++|}] ++ ++#rectypes;; ++ ++(* with rectypes: accepted (used to crash) *) ++external cast : int -> 'self nat as 'self = "%identity" ++;; ++[%%expect{| ++external cast : int -> 'a nat as 'a = "%identity" ++|}] +diff --git a/typing/typedecl.ml b/typing/typedecl.ml +index 9d38ebe97e..d00c0fc450 100644 +--- a/typing/typedecl.ml ++++ b/typing/typedecl.ml +@@ -1334,7 +1334,7 @@ let rec parse_native_repr_attributes env core_type ty ~global_repr = + parse_native_repr_attributes env ct2 t2 ~global_repr + in + (repr_arg :: repr_args, repr_res) +- | Ptyp_poly (_, t), _, _ -> ++ | (Ptyp_poly (_, t) | Ptyp_alias (t, _)), _, _ -> + parse_native_repr_attributes env t ty ~global_repr + | Ptyp_arrow _, _, _ | _, Tarrow _, _ -> assert false + | _ -> ([], make_native_repr env core_type ty ~global_repr) +-- +2.37.0.rc2 + diff --git a/0011-Document-limitation-on-caml_callbackN-11409.patch b/0011-Document-limitation-on-caml_callbackN-11409.patch new file mode 100644 index 0000000..bf09575 --- /dev/null +++ b/0011-Document-limitation-on-caml_callbackN-11409.patch @@ -0,0 +1,53 @@ +From 9d4faca7af8d9849093ff8d36509ad60608ac239 Mon Sep 17 00:00:00 2001 +From: Xavier Leroy +Date: Thu, 7 Jul 2022 18:22:22 +0200 +Subject: [PATCH 11/24] Document limitation on `caml_callbackN` (#11409) + +The `args` argument array must not be declared with `CAMLlocalN`, otherwise +the array can be registered a second time by `caml_callbackN`, confusing +the compactor. + +Also: suggests using a C99 compound literal, it looks good and avoids the issue. + +Fixes: #11045 +--- + Changes | 7 +++++++ + manual/src/cmds/intf-c.etex | 4 ++++ + 2 files changed, 11 insertions(+) + +diff --git a/Changes b/Changes +index 8182f5ced7..13eb7fef98 100644 +--- a/Changes ++++ b/Changes +@@ -25,6 +25,13 @@ OCaml 4.14 maintenance branch + - #11392, #11392: assertion failure with -rectypes and external definitions + (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev) + ++### Manual and documentation: ++ ++- #11045, #11409: document that the array argument to `caml_callbackN` ++ must not have been declared by `CAMLlocalN`. ++ (Xavier Leroy, report by Stephen Dolan, review by Gabriel Scherer.) ++ ++ + OCaml 4.14.0 (28 March 2022) + ---------------------------- + +diff --git a/manual/src/cmds/intf-c.etex b/manual/src/cmds/intf-c.etex +index 7cd50a1372..bb420c2940 100644 +--- a/manual/src/cmds/intf-c.etex ++++ b/manual/src/cmds/intf-c.etex +@@ -1449,6 +1449,10 @@ the value \var{a} and returns the value returned by~\var{f}. + (a curried OCaml function with three arguments) to \var{a}, \var{b} and \var{c}. + \item "caml_callbackN("\var{f, n, args}")" applies the functional value \var{f} + to the \var{n} arguments contained in the C array of values \var{args}. ++The array \var{args} must \emph{not} be declared with "CAMLlocalN". ++It should be declared as "value "\var{args}"["\var{n}"];". ++Alternatively, a C99 compound literal can be used: ++"caml_callbackN("\var{f, n, }"(value[]){"\nth{arg}{1}, \ldots, \nth{arg}{n}"})". + \end{itemize} + If the function \var{f} does not return, but raises an exception that + escapes the scope of the application, then this exception is +-- +2.37.0.rc2 + diff --git a/0012-Stop-calling-ranlib-on-created-installed-libraries-1.patch b/0012-Stop-calling-ranlib-on-created-installed-libraries-1.patch new file mode 100644 index 0000000..739914c --- /dev/null +++ b/0012-Stop-calling-ranlib-on-created-installed-libraries-1.patch @@ -0,0 +1,327 @@ +From 50fbd6685ec88f1dc81451923d7c80fb0d18ca8b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=A9bastien=20Hinderer?= +Date: Thu, 14 Apr 2022 19:19:46 +0200 +Subject: [PATCH 12/24] Stop calling ranlib on created / installed libraries + (#11184) + +`ranlib` seems unnecessary if a POSIX-compliant `ar` is used and time stamps are preserved when a `.a` file is installed. + +(cherry picked from commit c8e41bade529998c4e66975c88fabf3ac47d7078) +--- + Changes | 5 +++++ + INSTALL.adoc | 4 ++-- + Makefile | 2 -- + Makefile.build_config.in | 2 +- + Makefile.config.in | 4 ---- + configure | Bin 581827 -> 581549 bytes + configure.ac | 16 +++------------- + otherlibs/Makefile.otherlibs.common | 2 -- + otherlibs/dynlink/Makefile | 11 +++++------ + otherlibs/systhreads/Makefile | 3 --- + stdlib/Makefile | 1 - + tools/ocamlmklib.ml | 6 ++---- + utils/Makefile | 1 - + utils/ccomp.ml | 8 ++------ + utils/config.mli | 3 --- + utils/config.mlp | 2 -- + 16 files changed, 20 insertions(+), 50 deletions(-) + +diff --git a/Changes b/Changes +index 13eb7fef98..6f92ee9965 100644 +--- a/Changes ++++ b/Changes +@@ -25,6 +25,11 @@ OCaml 4.14 maintenance branch + - #11392, #11392: assertion failure with -rectypes and external definitions + (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev) + ++### Compiler user-interface and warnings: ++ ++- #11184: Stop calling ranlib on created / installed libraries ++ (Sébastien Hinderer, review by Xavier Leroy) ++ + ### Manual and documentation: + + - #11045, #11409: document that the array argument to `caml_callbackN` +diff --git a/INSTALL.adoc b/INSTALL.adoc +index f4199ca49a..08d67ebbbe 100644 +--- a/INSTALL.adoc ++++ b/INSTALL.adoc +@@ -43,8 +43,8 @@ + * Under Cygwin, the `gcc-core` package is required. `flexdll` is also necessary + for shared library support. + +-* Binutils including `ar`, `ranlib`, and `strip` are required if your +- distribution does not already provide them with the C compiler. ++* Binutils including `ar` and `strip` are required if your distribution ++ does not already provide them with the C compiler. + + == Configuration + +diff --git a/Makefile b/Makefile +index 3c74bc79df..0e92785da2 100644 +--- a/Makefile ++++ b/Makefile +@@ -585,8 +585,6 @@ endif + ifeq "$(INSTALL_OCAMLNAT)" "true" + $(INSTALL_PROG) ocamlnat$(EXE) "$(INSTALL_BINDIR)" + endif +- cd "$(INSTALL_COMPLIBDIR)" && \ +- $(RANLIB) ocamlcommon.$(A) ocamlbytecomp.$(A) ocamloptcomp.$(A) + + # Installation of the *.ml sources of compiler-libs + .PHONY: install-compiler-sources +diff --git a/Makefile.build_config.in b/Makefile.build_config.in +index eeac09dd76..4d6705d252 100644 +--- a/Makefile.build_config.in ++++ b/Makefile.build_config.in +@@ -20,7 +20,7 @@ + # $(ROOTDIR) has been defined. + + include $(ROOTDIR)/Makefile.config +-INSTALL ?= @INSTALL@ ++INSTALL ?= @INSTALL@ -p + INSTALL_DATA ?= @INSTALL_DATA@ + INSTALL_PROG ?= @INSTALL_PROGRAM@ + +diff --git a/Makefile.config.in b/Makefile.config.in +index eb3d85eb1d..4badb74c3f 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -88,10 +88,6 @@ LDFLAGS?=@LDFLAGS@ + ### How to invoke the C preprocessor through the C compiler + CPP=@CPP@ + +-### How to invoke ranlib +-RANLIB=@RANLIB@ +-RANLIBCMD=@RANLIBCMD@ +- + ### How to invoke ar + ARCMD=@AR@ + +diff --git a/configure b/configure +index 8a2c007fd221bc897a255b4aa80c7f23710fcb10..73ce66bfa0a3de5e886a88c973b2db288b5e4d03 100755 +GIT binary patch +delta 91 +zcmX?nP-EJyt==60{S#P(`nZ^plY(UJueamx2P^N?Ror2wRCOHK#ZgE(H{K3{og6RYK +zU>4b?CTHZsIKV)ezG4dNJs|}(H3gMwh?TVpF)A8{?X6Q;ftU@5*|)b&< + assert(String.length Config.ar > 0); +- let r1 = +- command(Printf.sprintf "%s rc %s %s" +- Config.ar quoted_archive (quote_files file_list)) in +- if r1 <> 0 || String.length Config.ranlib = 0 +- then r1 +- else command(Config.ranlib ^ " " ^ quoted_archive) ++ command(Printf.sprintf "%s rc %s %s" ++ Config.ar quoted_archive (quote_files file_list)) + + let expand_libname cclibs = + cclibs |> List.map (fun cclib -> +diff --git a/utils/config.mli b/utils/config.mli +index 7f70a52d52..94dee3cb92 100644 +--- a/utils/config.mli ++++ b/utils/config.mli +@@ -82,9 +82,6 @@ val mkexe: string + val mkmaindll: string + (** The linker command line to build main programs as dlls. *) + +-val ranlib: string +-(** Command to randomize a library, or "" if not needed *) +- + val default_rpath: string + (** Option to add a directory to be searched for libraries at runtime + (used by ocamlmklib) *) +diff --git a/utils/config.mlp b/utils/config.mlp +index 44c6ff8fa5..f758a9b483 100644 +--- a/utils/config.mlp ++++ b/utils/config.mlp +@@ -54,7 +54,6 @@ let native_c_compiler = + c_compiler ^ " " ^ ocamlopt_cflags ^ " " ^ ocamlopt_cppflags + let native_c_libraries = "%%NATIVECCLIBS%%" + let native_pack_linker = "%%PACKLD%%" +-let ranlib = "%%RANLIBCMD%%" + let default_rpath = "%%RPATH%%" + let mksharedlibrpath = "%%MKSHAREDLIBRPATH%%" + let ar = "%%ARCMD%%" +@@ -177,7 +176,6 @@ let configuration_variables = + p "bytecomp_c_libraries" bytecomp_c_libraries; + p "native_c_libraries" native_c_libraries; + p "native_pack_linker" native_pack_linker; +- p "ranlib" ranlib; + p "architecture" architecture; + p "model" model; + p_int "int_size" Sys.int_size; +-- +2.37.0.rc2 + diff --git a/0013-tests-lib-bigarray-2-has-gfortran.sh-don-t-print-any.patch b/0013-tests-lib-bigarray-2-has-gfortran.sh-don-t-print-any.patch new file mode 100644 index 0000000..7d5b111 --- /dev/null +++ b/0013-tests-lib-bigarray-2-has-gfortran.sh-don-t-print-any.patch @@ -0,0 +1,27 @@ +From c04f2fbb3ae4dc8f67882bfe35d8565f016dee0f Mon Sep 17 00:00:00 2001 +From: Xavier Leroy +Date: Fri, 15 Jul 2022 14:23:10 +0200 +Subject: [PATCH 13/24] tests/lib-bigarray-2/has-gfortran.sh: don't print + anything on stdout + +It confuses the summarize.awk script. +--- + testsuite/tests/lib-bigarray-2/has-gfortran.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/testsuite/tests/lib-bigarray-2/has-gfortran.sh b/testsuite/tests/lib-bigarray-2/has-gfortran.sh +index 051122113a..7eef1e662e 100644 +--- a/testsuite/tests/lib-bigarray-2/has-gfortran.sh ++++ b/testsuite/tests/lib-bigarray-2/has-gfortran.sh +@@ -5,7 +5,7 @@ if ! which gfortran > /dev/null 2>&1; then + elif ! grep -q '^CC=gcc' ${ocamlsrcdir}/Makefile.config; then + echo "OCaml was not compiled with gcc" > ${ocamltest_response} + test_result=${TEST_SKIP} +-elif gcc --version 2>&1 | grep 'Apple clang version'; then ++elif gcc --version 2>&1 | grep -q 'Apple clang version'; then + echo "OCaml was not compiled with gcc" > ${ocamltest_response} + test_result=${TEST_SKIP} + else +-- +2.37.0.rc2 + diff --git a/0014-Merge-pull-request-11417-from-lpw25-fix-virtual-clas.patch b/0014-Merge-pull-request-11417-from-lpw25-fix-virtual-clas.patch new file mode 100644 index 0000000..5a53fad --- /dev/null +++ b/0014-Merge-pull-request-11417-from-lpw25-fix-virtual-clas.patch @@ -0,0 +1,147 @@ +From 4bb84be29e2ea5eb9f979c5e3bcbde1933aa300e Mon Sep 17 00:00:00 2001 +From: Florian Angeletti +Date: Mon, 18 Jul 2022 10:08:53 +0200 +Subject: [PATCH 14/24] Merge pull request #11417 from + lpw25/fix-virtual-class-type-constrs + +Fix regression allowing virtual methods in non-virtual classes + +(cherry picked from commit 4be851ed8ea1f0c6be13dce04dcc97493c6c004b) +--- + Changes | 13 +----- + testsuite/tests/typing-objects/Tests.ml | 61 +++++++++++++++++++++++++ + typing/typeclass.ml | 11 +++++ + 3 files changed, 74 insertions(+), 11 deletions(-) + +diff --git a/Changes b/Changes +index 6f92ee9965..a9a9ee92f4 100644 +--- a/Changes ++++ b/Changes +@@ -25,17 +25,8 @@ OCaml 4.14 maintenance branch + - #11392, #11392: assertion failure with -rectypes and external definitions + (Gabriel Scherer, review by Florian Angeletti, report by Dmitrii Kosarev) + +-### Compiler user-interface and warnings: +- +-- #11184: Stop calling ranlib on created / installed libraries +- (Sébastien Hinderer, review by Xavier Leroy) +- +-### Manual and documentation: +- +-- #11045, #11409: document that the array argument to `caml_callbackN` +- must not have been declared by `CAMLlocalN`. +- (Xavier Leroy, report by Stephen Dolan, review by Gabriel Scherer.) +- ++- #11417: Fix regression allowing virtual methods in non-virtual classes. ++ (Leo White, review by Florian Angeletti) + + OCaml 4.14.0 (28 March 2022) + ---------------------------- +diff --git a/testsuite/tests/typing-objects/Tests.ml b/testsuite/tests/typing-objects/Tests.ml +index 3dcd87c43c..9cab28e432 100644 +--- a/testsuite/tests/typing-objects/Tests.ml ++++ b/testsuite/tests/typing-objects/Tests.ml +@@ -1344,3 +1344,64 @@ let _ = (new foo)#f true + class foo : object method f : bool -> bool end + - : bool = true + |}];; ++ ++ ++class c : object ++ method virtual m : int ++end = object ++ method m = 9 ++ end ++[%%expect {| ++Lines 1-3, characters 10-3: ++1 | ..........object ++2 | method virtual m : int ++3 | end......... ++Error: This non-virtual class type has virtual methods. ++ The following methods are virtual : m ++|}];; ++ ++class virtual c : object ++ method virtual m : int ++end = object ++ method m = 42 ++ end ++[%%expect {| ++class virtual c : object method virtual m : int end ++|}];; ++ ++class virtual cv = object ++ method virtual m : int ++ end ++ ++class c : cv = object ++ method m = 42 ++ end ++[%%expect {| ++class virtual cv : object method virtual m : int end ++Line 5, characters 10-12: ++5 | class c : cv = object ++ ^^ ++Error: This non-virtual class type has virtual methods. ++ The following methods are virtual : m ++|}];; ++ ++class virtual c : cv = object ++ method m = 41 ++ end ++[%%expect {| ++class virtual c : cv ++|}];; ++ ++class c = cv ++[%%expect {| ++Line 1, characters 10-12: ++1 | class c = cv ++ ^^ ++Error: This non-virtual class has virtual methods. ++ The following methods are virtual : m ++|}];; ++ ++class virtual c = cv ++[%%expect {| ++class virtual c : cv ++|}];; +diff --git a/typing/typeclass.ml b/typing/typeclass.ml +index fedbc0e025..8fa8523cc9 100644 +--- a/typing/typeclass.ml ++++ b/typing/typeclass.ml +@@ -177,6 +177,13 @@ let check_virtual loc env virt kind sign = + | meths, vars -> + raise(Error(loc, env, Virtual_class(kind, meths, vars))) + ++let rec check_virtual_clty loc env virt kind clty = ++ match clty with ++ | Cty_constr(_, _, clty) | Cty_arrow(_, _, clty) -> ++ check_virtual_clty loc env virt kind clty ++ | Cty_signature sign -> ++ check_virtual loc env virt kind sign ++ + (* Return the constructor type associated to a class type *) + let rec constructor_type constr cty = + match cty with +@@ -398,6 +405,8 @@ and class_type_aux env virt self_scope scty = + ) styl params + in + let typ = Cty_constr (path, params, clty) in ++ (* Check for unexpected virtual methods *) ++ check_virtual_clty scty.pcty_loc env virt Class_type typ; + cltyp (Tcty_constr ( path, lid , ctys)) typ + + | Pcty_signature pcsig -> +@@ -1077,6 +1086,8 @@ and class_expr_aux cl_num val_env met_env virt self_scope scl = + try Ctype.unify val_env ty' ty with Ctype.Unify err -> + raise(Error(cty'.ctyp_loc, val_env, Parameter_mismatch err))) + tyl params; ++ (* Check for unexpected virtual methods *) ++ check_virtual_clty scl.pcl_loc val_env virt Class clty'; + let cl = + rc {cl_desc = Tcl_ident (path, lid, tyl); + cl_loc = scl.pcl_loc; +-- +2.37.0.rc2 + diff --git a/0015-Do-not-elide-the-whole-module-type-error-message-114.patch b/0015-Do-not-elide-the-whole-module-type-error-message-114.patch new file mode 100644 index 0000000..2922112 --- /dev/null +++ b/0015-Do-not-elide-the-whole-module-type-error-message-114.patch @@ -0,0 +1,154 @@ +From 54eef17aeecfdbc6eeecd60b9cc64cd7c0129429 Mon Sep 17 00:00:00 2001 +From: Florian Angeletti +Date: Wed, 20 Jul 2022 10:58:18 +0200 +Subject: [PATCH 15/24] Do not elide the whole module type error message + (#11416) + +(cherry picked from commit 8218be9e2b24907b8558776a34d12032bcc42496) +--- + Changes | 5 +- + .../inclusion_errors_elision.ml | 93 +++++++++++++++++++ + typing/includemod_errorprinter.ml | 11 ++- + 3 files changed, 107 insertions(+), 2 deletions(-) + create mode 100644 testsuite/tests/typing-modules/inclusion_errors_elision.ml + +diff --git a/Changes b/Changes +index a9a9ee92f4..6b9855f707 100644 +--- a/Changes ++++ b/Changes +@@ -14,7 +14,10 @@ OCaml 4.14 maintenance branch + (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and + Sebastien Hinderer) + +-- #11358, #11378: Refactor the initialization of bytecode threading. ++- #11314, #11416: fix non-informative error message for module inclusion ++ (Florian Angeletti, report by Thierry Martinez, review by Gabriel Scherer) ++ ++- #11358, #11379: Refactor the initialization of bytecode threading, + This avoids a "dangling pointer" warning of GCC 12.1. + (Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer) + +diff --git a/testsuite/tests/typing-modules/inclusion_errors_elision.ml b/testsuite/tests/typing-modules/inclusion_errors_elision.ml +new file mode 100644 +index 0000000000..3dbd0e67ff +--- /dev/null ++++ b/testsuite/tests/typing-modules/inclusion_errors_elision.ml +@@ -0,0 +1,93 @@ ++(* TEST ++ flags ="-keep-original-error-size" ++ * expect ++ *) ++ ++ ++module A = struct ++ type a and b and c and d ++end ++ ++module type S = sig ++ module B = A ++end ++ ++module C : S = struct ++ module B = struct ++ type a and b and c and d and e and f and g and h ++ end ++end ++[%%expect {| ++module A : sig type a and b and c and d end ++module type S = sig module B = A end ++Lines 9-13, characters 15-3: ++ 9 | ...............struct ++10 | module B = struct ++11 | type a and b and c and d and e and f and g and h ++12 | end ++13 | end ++Error: Signature mismatch: ++ ... ++ In module B: ++ Modules do not match: ++ sig ++ type a = B.a ++ and b = B.b ++ and c = B.c ++ and d = B.d ++ and e = B.e ++ and f = B.f ++ and g = B.g ++ and h = B.h ++ end ++ is not included in ++ (module A) ++|}] ++ ++module A = struct ++ type a and b and c and d ++end ++ ++module type S = sig ++ module type B = sig ++ module C = A ++ end ++end ++ ++module D : S = struct ++ module type B = sig ++ module C: sig ++ type a and b and c and d and e and f and g and h ++ end ++ end ++end ++[%%expect{| ++module A : sig type a and b and c and d end ++module type S = sig module type B = sig module C = A end end ++Lines 11-17, characters 15-3: ++11 | ...............struct ++12 | module type B = sig ++13 | module C: sig ++14 | type a and b and c and d and e and f and g and h ++15 | end ++16 | end ++17 | end ++Error: Signature mismatch: ++ ... ++ ... ++ ... ++ At position module type B = sig module C : end ++ Modules do not match: ++ sig ++ type a = C.a ++ and b = C.b ++ and c = C.c ++ and d = C.d ++ and e = C.e ++ and f = C.f ++ and g = C.g ++ and h = C.h ++ end ++ is not included in ++ (module A) ++|}] +diff --git a/typing/includemod_errorprinter.ml b/typing/includemod_errorprinter.ml +index 24d452fddc..b719e1627d 100644 +--- a/typing/includemod_errorprinter.ml ++++ b/typing/includemod_errorprinter.ml +@@ -709,7 +709,16 @@ let rec module_type ~expansion_token ~eqmode ~env ~before ~ctx diff = + functor_params ~expansion_token ~env ~before ~ctx d + | _ -> + let inner = if eqmode then eq_module_types else module_types in +- let next = dwith_context_and_elision ctx inner diff in ++ let next = ++ match diff.symptom with ++ | Mt_core _ -> ++ (* In those cases, the refined error messages for the current error ++ will at most add some minor comments on the current error. ++ It is thus better to avoid eliding the current error message. ++ *) ++ dwith_context ctx (inner diff) ++ | _ -> dwith_context_and_elision ctx inner diff ++ in + let before = next :: before in + module_type_symptom ~eqmode ~expansion_token ~env ~before ~ctx + diff.symptom +-- +2.37.0.rc2 + diff --git a/0016-Merge-pull-request-11373-from-dra27-flexlink-detect.patch b/0016-Merge-pull-request-11373-from-dra27-flexlink-detect.patch new file mode 100644 index 0000000..059fc99 --- /dev/null +++ b/0016-Merge-pull-request-11373-from-dra27-flexlink-detect.patch @@ -0,0 +1,57 @@ +From 4d316cbe4b564be3aa57b969acf9ba03910dcba4 Mon Sep 17 00:00:00 2001 +From: David Allsopp +Date: Sat, 30 Jul 2022 11:51:12 +0200 +Subject: [PATCH 16/24] Merge pull request #11373 from dra27/flexlink-detect + +Don't use CFLAGS when testing flexlink + +(cherry picked from commit 004d313ce4fdb071d0aeda8736b9e74bb6c6a21b) +--- + Changes | 6 ++++++ + aclocal.m4 | 1 + + configure | Bin 581549 -> 581563 bytes + 3 files changed, 7 insertions(+) + +diff --git a/Changes b/Changes +index 6b9855f707..99907b950a 100644 +--- a/Changes ++++ b/Changes +@@ -1,6 +1,12 @@ + OCaml 4.14 maintenance branch + ----------------------------- + ++### Build system: ++ ++- #11370, #11373: Don't pass CFLAGS to flexlink during configure. ++ (David Allsopp, report by William Hu, review by Xavier Leroy and ++ Sébastien Hinderer) ++ + ### Bug fixes: + + - #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when +diff --git a/aclocal.m4 b/aclocal.m4 +index 7e49468e48..2bc0a1dcc9 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -328,6 +328,7 @@ AC_DEFUN([OCAML_TEST_FLEXLINK], [ + CC="$1 -chain $2 -exe" + LIBS="conftest2.$ac_objext" + CPPFLAGS="$3 $CPPFLAGS" ++ CFLAGS="" + AC_LINK_IFELSE( + [AC_LANG_SOURCE([int main() { return 0; }])], + [AC_MSG_RESULT([yes])], +diff --git a/configure b/configure +index 73ce66bfa0a3de5e886a88c973b2db288b5e4d03..c0dde03f183f86677b22a81238defdba60ad0080 100755 +GIT binary patch +delta 57 +zcmZ3xUwQX_<%Sl<7N!>F7M3lnkFIk%yZJb}2iqzsO&46x?lIl3ot?8??*=OnvjH*t +KcD)-M_3Qv?gA|zn + +delta 47 +zcmdnJUwQ3*<%Sl<7N!>F7M3lnkFHM-Tg~P?U2ZNbN4xb6Rv=~rV)pIUH#i#D0n)${ +AvH$=8 + +-- +2.37.0.rc2 + diff --git a/0017-Merge-pull-request-11468-from-dra27-i686-mingw-ipv6.patch b/0017-Merge-pull-request-11468-from-dra27-i686-mingw-ipv6.patch new file mode 100644 index 0000000..433fda9 --- /dev/null +++ b/0017-Merge-pull-request-11468-from-dra27-i686-mingw-ipv6.patch @@ -0,0 +1,55 @@ +From defecc867a0b5653554c41b06e78c0f24f6c10a8 Mon Sep 17 00:00:00 2001 +From: David Allsopp +Date: Tue, 2 Aug 2022 17:21:08 +0100 +Subject: [PATCH 17/24] Merge pull request #11468 from dra27/i686-mingw-ipv6 + +Fix detection of IPv6 on mingw-w64 i686 + +(cherry picked from commit 98392895940cc1c18534280ae001b70fa5bf24c2) +--- + Changes | 4 ++++ + configure | Bin 581563 -> 581611 bytes + configure.ac | 1 + + 3 files changed, 5 insertions(+) + +diff --git a/Changes b/Changes +index 99907b950a..6b537edca9 100644 +--- a/Changes ++++ b/Changes +@@ -37,6 +37,10 @@ OCaml 4.14 maintenance branch + - #11417: Fix regression allowing virtual methods in non-virtual classes. + (Leo White, review by Florian Angeletti) + ++- #11468: Fix regression from #10186 (OCaml 4.13) detecting IPv6 on Windows for ++ mingw-w64 i686 port. ++ (David Allsopp, review by Xavier Leroy and Sébastien Hinderer) ++ + OCaml 4.14.0 (28 March 2022) + ---------------------------- + +diff --git a/configure b/configure +index c0dde03f183f86677b22a81238defdba60ad0080..536a1cbee58a430692bfa3de11901e7e2f6b4ee2 100755 +GIT binary patch +delta 53 +zcmdnJU-|WZ<%Sl<7N!>F7M2#)7Pc+y(YK}x+-47$p3}xEG`-+2o7nVsH`#OBfnwVQ +JZgZ?=0RTku6-595 + +delta 53 +zcmV-50LuUCzazW9BY=bfgaU*Egam{Iga)(+TiTa!+Xo<*Y=#9AmvH?C7MJeX2fc@o +L+XuIh+X!0(RZ +Date: Mon, 22 Aug 2022 16:06:50 +0200 +Subject: [PATCH 18/24] More prudent deallocation of alternate signal stack + (#11496) + +After `caml_setup_stack_overflow_detection` is called, +a C library can install its own alternate stack for signal handling. + +Therefore, `caml_stop_stack_overflow_detection` must not free the +alternate signal stack block, only the block that +`caml_setup_stack_overflow_detection` allocated. + +Fixes: #11489 +--- + Changes | 4 +++ + otherlibs/systhreads/st_stubs.c | 5 ++-- + runtime/caml/signals.h | 4 +-- + runtime/signals_byt.c | 4 +-- + runtime/signals_nat.c | 47 +++++++++++++++++++++------------ + 5 files changed, 41 insertions(+), 23 deletions(-) + +diff --git a/Changes b/Changes +index 6b537edca9..4d1bb10435 100644 +--- a/Changes ++++ b/Changes +@@ -41,6 +41,10 @@ OCaml 4.14 maintenance branch + mingw-w64 i686 port. + (David Allsopp, review by Xavier Leroy and Sébastien Hinderer) + ++- #11489, #11496: More prudent deallocation of alternate signal stack ++ (Xavier Leroy, report by @rajdakin, review by Florian Angeletti) ++ ++ + OCaml 4.14.0 (28 March 2022) + ---------------------------- + +diff --git a/otherlibs/systhreads/st_stubs.c b/otherlibs/systhreads/st_stubs.c +index b7a6a9a6bb..043e07031e 100644 +--- a/otherlibs/systhreads/st_stubs.c ++++ b/otherlibs/systhreads/st_stubs.c +@@ -524,6 +524,7 @@ static ST_THREAD_FUNCTION caml_thread_start(void * arg) + { + caml_thread_t th = (caml_thread_t) arg; + value clos; ++ void * signal_stack; + #ifdef NATIVE_CODE + struct longjmp_buffer termination_buf; + char tos; +@@ -536,7 +537,7 @@ static ST_THREAD_FUNCTION caml_thread_start(void * arg) + /* Acquire the global mutex */ + caml_leave_blocking_section(); + st_thread_set_id(Ident(th->descr)); +- caml_setup_stack_overflow_detection(); ++ signal_stack = caml_setup_stack_overflow_detection(); + #ifdef NATIVE_CODE + /* Setup termination handler (for caml_thread_exit) */ + if (sigsetjmp(termination_buf.buf, 0) == 0) { +@@ -550,7 +551,7 @@ static ST_THREAD_FUNCTION caml_thread_start(void * arg) + #ifdef NATIVE_CODE + } + #endif +- caml_stop_stack_overflow_detection(); ++ caml_stop_stack_overflow_detection(signal_stack); + /* The thread now stops running */ + return 0; + } +diff --git a/runtime/caml/signals.h b/runtime/caml/signals.h +index c6aeebfc78..62b0e7fafa 100644 +--- a/runtime/caml/signals.h ++++ b/runtime/caml/signals.h +@@ -87,8 +87,8 @@ value caml_do_pending_actions_exn (void); + value caml_process_pending_actions_with_root (value extra_root); // raises + value caml_process_pending_actions_with_root_exn (value extra_root); + int caml_set_signal_action(int signo, int action); +-CAMLextern int caml_setup_stack_overflow_detection(void); +-CAMLextern int caml_stop_stack_overflow_detection(void); ++CAMLextern void * caml_setup_stack_overflow_detection(void); ++CAMLextern int caml_stop_stack_overflow_detection(void *); + CAMLextern void caml_init_signals(void); + CAMLextern void caml_terminate_signals(void); + CAMLextern void (*caml_enter_blocking_section_hook)(void); +diff --git a/runtime/signals_byt.c b/runtime/signals_byt.c +index 439fb56404..7cb461ac4d 100644 +--- a/runtime/signals_byt.c ++++ b/runtime/signals_byt.c +@@ -81,7 +81,7 @@ int caml_set_signal_action(int signo, int action) + return 0; + } + +-CAMLexport int caml_setup_stack_overflow_detection(void) { return 0; } +-CAMLexport int caml_stop_stack_overflow_detection(void) { return 0; } ++CAMLexport void * caml_setup_stack_overflow_detection(void) { return NULL; } ++CAMLexport int caml_stop_stack_overflow_detection(void * p) { return 0; } + CAMLexport void caml_init_signals(void) { } + CAMLexport void caml_terminate_signals(void) { } +diff --git a/runtime/signals_nat.c b/runtime/signals_nat.c +index 443f5d53b6..1dd8289c12 100644 +--- a/runtime/signals_nat.c ++++ b/runtime/signals_nat.c +@@ -254,6 +254,10 @@ DECLARE_SIGNAL_HANDLER(segv_handler) + + /* Initialization of signal stuff */ + ++#ifdef HAS_STACK_OVERFLOW_DETECTION ++static void * caml_signal_stack = NULL; ++#endif ++ + void caml_init_signals(void) + { + /* Bound-check trap handling */ +@@ -278,7 +282,8 @@ void caml_init_signals(void) + #endif + + #ifdef HAS_STACK_OVERFLOW_DETECTION +- if (caml_setup_stack_overflow_detection() != -1) { ++ caml_signal_stack = caml_setup_stack_overflow_detection(); ++ if (caml_signal_stack != NULL) { + struct sigaction act; + SET_SIGACT(act, segv_handler); + act.sa_flags |= SA_ONSTACK | SA_NODEFER; +@@ -314,7 +319,8 @@ void caml_terminate_signals(void) + + #ifdef HAS_STACK_OVERFLOW_DETECTION + set_signal_default(SIGSEGV); +- caml_stop_stack_overflow_detection(); ++ caml_stop_stack_overflow_detection(caml_signal_stack); ++ caml_signal_stack = NULL; + #endif + } + +@@ -323,37 +329,44 @@ void caml_terminate_signals(void) + Each thread needs its own alternate stack. + The alternate stack used to be statically-allocated for the main thread, + but this is incompatible with Glibc 2.34 and newer, where SIGSTKSZ +- may not be a compile-time constant (issue #10250). */ ++ may not be a compile-time constant (issue #10250). ++ Return the dynamically-allocated alternate signal stack, or NULL ++ if an error occurred. ++ The returned pointer must be passed to [caml_stop_stack_overflow_detection]. ++*/ + +-CAMLexport int caml_setup_stack_overflow_detection(void) ++CAMLexport void * caml_setup_stack_overflow_detection(void) + { + #ifdef HAS_STACK_OVERFLOW_DETECTION + stack_t stk; +- stk.ss_sp = malloc(SIGSTKSZ); +- if (stk.ss_sp == NULL) return -1; + stk.ss_size = SIGSTKSZ; ++ stk.ss_sp = malloc(stk.ss_size); ++ if (stk.ss_sp == NULL) return NULL; + stk.ss_flags = 0; + if (sigaltstack(&stk, NULL) == -1) { + free(stk.ss_sp); +- return -1; ++ return NULL; + } ++ return stk.ss_sp; ++#else ++ return NULL; + #endif +- /* Success (or stack overflow detection not available) */ +- return 0; + } + +-CAMLexport int caml_stop_stack_overflow_detection(void) ++CAMLexport int caml_stop_stack_overflow_detection(void * signal_stack) + { + #ifdef HAS_STACK_OVERFLOW_DETECTION + stack_t oldstk, stk; + stk.ss_flags = SS_DISABLE; ++ stk.ss_sp = NULL; /* not required but avoids a valgrind false alarm */ ++ stk.ss_size = SIGSTKSZ; /* macOS wants a valid size here */ + if (sigaltstack(&stk, &oldstk) == -1) return -1; +- /* If caml_setup_stack_overflow_detection failed, we are not using +- an alternate signal stack. SS_DISABLE will be set in oldstk, +- and there is nothing to free in this case. */ +- if (! (oldstk.ss_flags & SS_DISABLE)) free(oldstk.ss_sp); +- return 0; +-#else +- return 0; ++ /* Check whether someone else installed their own signal stack */ ++ if (!(oldstk.ss_flags & SS_DISABLE) && oldstk.ss_sp != signal_stack) { ++ /* Re-activate their signal stack. */ ++ sigaltstack(&oldstk, NULL); ++ } ++ free(signal_stack); + #endif ++ return 0; + } +-- +2.37.0.rc2 + diff --git a/0019-Merge-pull-request-11487-from-purplearmadillo77-fma_.patch b/0019-Merge-pull-request-11487-from-purplearmadillo77-fma_.patch new file mode 100644 index 0000000..67376f4 --- /dev/null +++ b/0019-Merge-pull-request-11487-from-purplearmadillo77-fma_.patch @@ -0,0 +1,54 @@ +From a4633757e352b30f136d2a1cda827289d826ddc0 Mon Sep 17 00:00:00 2001 +From: David Allsopp +Date: Thu, 25 Aug 2022 08:44:47 +0100 +Subject: [PATCH 19/24] Merge pull request #11487 from + purplearmadillo77/fma_test + +Thwart FMA test optimization during configure + +(cherry picked from commit cd7dc7f6b9b5353acc2aa70bdc7bbecff56634d0) +--- + Changes | 3 +++ + aclocal.m4 | 2 +- + configure | Bin 581611 -> 581620 bytes + 3 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/Changes b/Changes +index 4d1bb10435..763c0fa4b7 100644 +--- a/Changes ++++ b/Changes +@@ -7,6 +7,9 @@ OCaml 4.14 maintenance branch + (David Allsopp, report by William Hu, review by Xavier Leroy and + Sébastien Hinderer) + ++- #11???: Thwart FMA test optimization during configure ++ (William Hu, review by ???) ++ + ### Bug fixes: + + - #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when +diff --git a/aclocal.m4 b/aclocal.m4 +index 2bc0a1dcc9..addb0d8bbf 100644 +--- a/aclocal.m4 ++++ b/aclocal.m4 +@@ -440,7 +440,7 @@ int main (void) { + broken implementations of Cygwin64, mingw-w64 (x86_64) and VS2013-2017. + The static volatile variables aim to thwart GCC's constant folding. */ + static volatile double x, y, z; +- double t264, t265, t266; ++ volatile double t264, t265, t266; + x = 0x3.bd5b7dde5fddap-496; + y = 0x3.bd5b7dde5fddap-496; + z = -0xd.fc352bc352bap-992; +diff --git a/configure b/configure +index 536a1cbee58a430692bfa3de11901e7e2f6b4ee2..1a1dd61863e0435952ba6d6baf8131e68f070b3d 100755 +GIT binary patch +delta 44 +zcmaF8U-`>^<%Sl<7N!>F7M2#)Eo_r#a+KxgB$j06q_$6*$p*yi+b7NBh;#!0qIVJx + +delta 35 +qcmeyeU-|WZ<%Sl<7N!>F7M2#)Eo_r#w$GW#2E^>!=gj1Ya037qBM!s> + +-- +2.37.0.rc2 + diff --git a/0020-Fixup-Changes.patch b/0020-Fixup-Changes.patch new file mode 100644 index 0000000..1301d95 --- /dev/null +++ b/0020-Fixup-Changes.patch @@ -0,0 +1,36 @@ +From 19f5ef04dc344a82a3831f4b16f0be75c813dbf6 Mon Sep 17 00:00:00 2001 +From: David Allsopp +Date: Thu, 25 Aug 2022 08:48:34 +0100 +Subject: [PATCH 20/24] Fixup Changes + +--- + Changes | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Changes b/Changes +index 763c0fa4b7..92d0837eb6 100644 +--- a/Changes ++++ b/Changes +@@ -7,8 +7,8 @@ OCaml 4.14 maintenance branch + (David Allsopp, report by William Hu, review by Xavier Leroy and + Sébastien Hinderer) + +-- #11???: Thwart FMA test optimization during configure +- (William Hu, review by ???) ++- #11487: Thwart FMA test optimization during configure ++ (William Hu, review by David Allsopp and Sébastien Hinderer) + + ### Bug fixes: + +@@ -21,7 +21,7 @@ OCaml 4.14 maintenance branch + before using it to ensure that the headers can always be used in code which + turns on -Wundef (or equivalent). + (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and +- Sebastien Hinderer) ++ Sébastien Hinderer) + + - #11314, #11416: fix non-informative error message for module inclusion + (Florian Angeletti, report by Thierry Martinez, review by Gabriel Scherer) +-- +2.37.0.rc2 + diff --git a/0021-Fix-deprecated_mutable-which-couldn-t-be-triggered.-.patch b/0021-Fix-deprecated_mutable-which-couldn-t-be-triggered.-.patch new file mode 100644 index 0000000..913074d --- /dev/null +++ b/0021-Fix-deprecated_mutable-which-couldn-t-be-triggered.-.patch @@ -0,0 +1,90 @@ +From e6dfa704c0f7847fe8e7a2a153714b4075019a0f Mon Sep 17 00:00:00 2001 +From: Chris Casinghino +Date: Fri, 2 Sep 2022 10:28:55 -0400 +Subject: [PATCH 21/24] Fix [@deprecated_mutable], which couldn't be triggered. + (#11524) + +Fixes #11516 + +(cherry picked from commit 024ca164ab844a9be94e0675bb5a1693bab7c08f) +--- + Changes | 2 ++ + .../warnings/deprecated_mutable.compilers.reference | 4 ++++ + testsuite/tests/warnings/deprecated_mutable.ml | 13 +++++++++++++ + typing/env.ml | 9 ++++++++- + 4 files changed, 27 insertions(+), 1 deletion(-) + create mode 100644 testsuite/tests/warnings/deprecated_mutable.compilers.reference + create mode 100644 testsuite/tests/warnings/deprecated_mutable.ml + +diff --git a/Changes b/Changes +index 92d0837eb6..aa8880ad07 100644 +--- a/Changes ++++ b/Changes +@@ -47,6 +47,8 @@ OCaml 4.14 maintenance branch + - #11489, #11496: More prudent deallocation of alternate signal stack + (Xavier Leroy, report by @rajdakin, review by Florian Angeletti) + ++- #11516, #11524: Fix the `deprecated_mutable` attribute. ++ (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti) + + OCaml 4.14.0 (28 March 2022) + ---------------------------- +diff --git a/testsuite/tests/warnings/deprecated_mutable.compilers.reference b/testsuite/tests/warnings/deprecated_mutable.compilers.reference +new file mode 100644 +index 0000000000..620dc57de9 +--- /dev/null ++++ b/testsuite/tests/warnings/deprecated_mutable.compilers.reference +@@ -0,0 +1,4 @@ ++File "deprecated_mutable.ml", line 13, characters 11-12: ++13 | let () = y.x <- 42 ++ ^ ++Alert deprecated: mutating field x +diff --git a/testsuite/tests/warnings/deprecated_mutable.ml b/testsuite/tests/warnings/deprecated_mutable.ml +new file mode 100644 +index 0000000000..78fb12ac41 +--- /dev/null ++++ b/testsuite/tests/warnings/deprecated_mutable.ml +@@ -0,0 +1,13 @@ ++(* TEST ++ ++flags = "-w +A-70" ++ ++* bytecode ++ ++*) ++ ++type t = {mutable x : int [@deprecated_mutable]} ++ ++let y : t = {x = 5} ++ ++let () = y.x <- 42 +diff --git a/typing/env.ml b/typing/env.ml +index 06b99f4159..29d7cdb0e4 100644 +--- a/typing/env.ml ++++ b/typing/env.ml +@@ -104,6 +104,10 @@ let add_label_usage lu usage = + lu.lu_mutation <- true; + lu.lu_construct <- true + ++let is_mutating_label_usage = function ++ | Mutation -> true ++ | (Projection | Construct | Exported_private | Exported) -> false ++ + let label_usages () = + {lu_projection = false; lu_mutation = false; lu_construct = false} + +@@ -2723,7 +2727,10 @@ let use_cltype ~use ~loc path desc = + let use_label ~use ~loc usage env lbl = + if use then begin + mark_label_description_used usage env lbl; +- Builtin_attributes.check_alerts loc lbl.lbl_attributes lbl.lbl_name ++ Builtin_attributes.check_alerts loc lbl.lbl_attributes lbl.lbl_name; ++ if is_mutating_label_usage usage then ++ Builtin_attributes.check_deprecated_mutable loc lbl.lbl_attributes ++ lbl.lbl_name + end + + let use_constructor_desc ~use ~loc usage env cstr = +-- +2.37.0.rc2 + diff --git a/0006-Don-t-add-rpaths-to-libraries.patch b/0022-Don-t-add-rpaths-to-libraries.patch similarity index 69% rename from 0006-Don-t-add-rpaths-to-libraries.patch rename to 0022-Don-t-add-rpaths-to-libraries.patch index e776416..52b102b 100644 --- a/0006-Don-t-add-rpaths-to-libraries.patch +++ b/0022-Don-t-add-rpaths-to-libraries.patch @@ -1,20 +1,20 @@ -From fc7eb8e75bee1b8bf12dcbb7787781169b260558 Mon Sep 17 00:00:00 2001 +From e5312a9c481f91f2ca2cae1dc4176a78baaebf40 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 6/9] Don't add rpaths to libraries. +Subject: [PATCH 22/24] Don't add rpaths to libraries. --- utils/config.mlp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/config.mlp b/utils/config.mlp -index 44c6ff8fa5..a12c31a2bd 100644 +index f758a9b483..ee17a737dc 100644 --- a/utils/config.mlp +++ b/utils/config.mlp -@@ -55,8 +55,8 @@ let native_c_compiler = +@@ -54,8 +54,8 @@ let native_c_compiler = + c_compiler ^ " " ^ ocamlopt_cflags ^ " " ^ ocamlopt_cppflags let native_c_libraries = "%%NATIVECCLIBS%%" let native_pack_linker = "%%PACKLD%%" - let ranlib = "%%RANLIBCMD%%" -let default_rpath = "%%RPATH%%" -let mksharedlibrpath = "%%MKSHAREDLIBRPATH%%" +let default_rpath = "" @@ -23,5 +23,5 @@ index 44c6ff8fa5..a12c31a2bd 100644 let supports_shared_libraries = %%SUPPORTS_SHARED_LIBRARIES%% let mkdll, mkexe, mkmaindll = -- -2.36.1 +2.37.0.rc2 diff --git a/0007-configure-Allow-user-defined-C-compiler-flags.patch b/0023-configure-Allow-user-defined-C-compiler-flags.patch similarity index 71% rename from 0007-configure-Allow-user-defined-C-compiler-flags.patch rename to 0023-configure-Allow-user-defined-C-compiler-flags.patch index 77a031b..fc715f8 100644 --- a/0007-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0023-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,17 +1,17 @@ -From b91178cc8fdf657933c26d54a0c67fd69eb67427 Mon Sep 17 00:00:00 2001 +From 2501cd8b3c40188e5eb6dd2158d61cfa023236c2 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 7/9] configure: Allow user defined C compiler flags. +Subject: [PATCH 23/24] configure: Allow user defined C compiler flags. --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac -index 2f4ebf9b30..5ccfe8fb01 100644 +index ebb8bbdb80..9e6c0b9745 100644 --- a/configure.ac +++ b/configure.ac -@@ -690,6 +690,10 @@ AS_CASE([$host], +@@ -680,6 +680,10 @@ AS_CASE([$host], internal_cflags="$cc_warnings"], [common_cflags="-O"])]) @@ -23,5 +23,5 @@ index 2f4ebf9b30..5ccfe8fb01 100644 # Enable SSE2 on x86 mingw to avoid using 80-bit registers. -- -2.36.1 +2.37.0.rc2 diff --git a/0009-configure-Only-use-OC_-for-building-executables.patch b/0024-configure-Only-use-OC_-for-building-executables.patch similarity index 83% rename from 0009-configure-Only-use-OC_-for-building-executables.patch rename to 0024-configure-Only-use-OC_-for-building-executables.patch index 8432e41..1dbe2f2 100644 --- a/0009-configure-Only-use-OC_-for-building-executables.patch +++ b/0024-configure-Only-use-OC_-for-building-executables.patch @@ -1,7 +1,7 @@ -From 05b882737e0daecb86a6ef54e192508c60efcd88 Mon Sep 17 00:00:00 2001 +From 8e9ee6f765273d2c385b590a593e784472753d87 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 26 Jan 2022 15:47:02 +0000 -Subject: [PATCH 9/9] configure: Only use OC_* for building executables +Subject: [PATCH 24/24] configure: Only use OC_* for building executables Fedora >= 36 fills LD_FLAGS with lots of cruft, particularly stuff for "package notes" which contains build paths. @@ -14,7 +14,7 @@ ocamlopt uses. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index c763310acb..9cce5ea47a 100644 +index 9e6c0b9745..cab4cbd579 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ CONFIGURE_ARGS="$*" @@ -27,5 +27,5 @@ index c763310acb..9cce5ea47a 100644 # Flags for building executable files with debugging symbols mkexedebugflag="-g" -- -2.36.1 +2.37.0.rc2 diff --git a/ocaml.spec b/ocaml.spec index d538213..3f03c76 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -34,7 +34,7 @@ Name: ocaml Version: 4.14.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: OCaml compiler and programming environment @@ -53,7 +53,7 @@ Source0: https://github.com/ocaml/ocaml/archive/%{version}/%{name}-%{vers # # https://pagure.io/fedora-ocaml # -# Current branch: fedora-37-4.14.0 +# Current branch: fedora-38-4.14.0 # # ALTERNATIVELY add a patch to the end of the list (leaving the # existing patches unchanged) adding a comment to note that it should @@ -65,11 +65,27 @@ Patch0002: 0002-Merge-pull-request-11236-from-Nymphium-missing-since.patch Patch0003: 0003-misc.h-fix-preprocessor-conditional-on-_MSC_VER.patch Patch0004: 0004-Changes.patch Patch0005: 0005-Guard-more-instances-of-undefined-_MSC_VER.patch +Patch0006: 0006-Better-documentation-for-string_of_float-.-11353.patch +Patch0007: 0007-Merge-pull-request-11380-from-damiendoligez-fix-fort.patch +Patch0008: 0008-Refactor-the-initialization-of-bytecode-threading-11.patch +Patch0009: 0009-Merge-pull-request-11397-from-Octachron-tast_mapper_.patch +Patch0010: 0010-Merge-pull-request-11396-from-gasche-fix11392.patch +Patch0011: 0011-Document-limitation-on-caml_callbackN-11409.patch +Patch0012: 0012-Stop-calling-ranlib-on-created-installed-libraries-1.patch +Patch0013: 0013-tests-lib-bigarray-2-has-gfortran.sh-don-t-print-any.patch +Patch0014: 0014-Merge-pull-request-11417-from-lpw25-fix-virtual-clas.patch +Patch0015: 0015-Do-not-elide-the-whole-module-type-error-message-114.patch +Patch0016: 0016-Merge-pull-request-11373-from-dra27-flexlink-detect.patch +Patch0017: 0017-Merge-pull-request-11468-from-dra27-i686-mingw-ipv6.patch +Patch0018: 0018-More-prudent-deallocation-of-alternate-signal-stack-.patch +Patch0019: 0019-Merge-pull-request-11487-from-purplearmadillo77-fma_.patch +Patch0020: 0020-Fixup-Changes.patch +Patch0021: 0021-Fix-deprecated_mutable-which-couldn-t-be-triggered.-.patch + # Fedora-specific patches -Patch0006: 0006-Don-t-add-rpaths-to-libraries.patch -Patch0007: 0007-configure-Allow-user-defined-C-compiler-flags.patch -Patch0008: 0008-configure-Remove-incorrect-assumption-about-cross-co.patch -Patch0009: 0009-configure-Only-use-OC_-for-building-executables.patch +Patch0022: 0022-Don-t-add-rpaths-to-libraries.patch +Patch0023: 0023-configure-Allow-user-defined-C-compiler-flags.patch +Patch0024: 0024-configure-Only-use-OC_-for-building-executables.patch BuildRequires: make BuildRequires: git @@ -183,22 +199,28 @@ unset MAKEFLAGS make=make %endif +# Don't use %%configure macro because it sets --build, --host which +# breaks some incorrect assumptions made by OCaml's configure.ac +# +# See also: +# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/2O4HBOK6PTQZAFAVIRDVMZGG2PYB2QHM/ +# https://github.com/ocaml/ocaml/issues/8647 +# # We set --libdir to the unusual directory because we want OCaml to # install its libraries and other files into a subdirectory. # -# Force --host because of: -# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/2O4HBOK6PTQZAFAVIRDVMZGG2PYB2QHM/ -# (see also https://github.com/ocaml/ocaml/issues/8647) -# # OC_CFLAGS/OC_LDFLAGS control what flags OCaml passes to the linker # when doing final linking of OCaml binaries. Setting these is # necessary to ensure that generated binaries have Fedora hardening # features. -%configure \ +./configure \ + --prefix=%{_prefix} \ + --sysconfdir=%{_sysconfdir} \ + --mandir=%{_mandir} \ + --libdir=%{_libdir}/ocaml \ OC_CFLAGS="$CFLAGS" \ OC_LDFLAGS="$LDFLAGS" \ - --libdir=%{_libdir}/ocaml \ - --host=`./build-aux/config.guess` + %{nil} $make world %if %{native_compiler} $make opt @@ -378,6 +400,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata %changelog +* Mon Sep 5 2022 Richard W.M. Jones - 4.14.0-3 +- Include more upstream patches from 4.14 branch + * Fri Jul 22 2022 Fedora Release Engineering - 4.14.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild